Skip to content

Commit 3096928

Browse files
committed
unix: Disable the GIL to improve performance of non-thread code.
Threading support is still very new so stay conservative at this point and enable threading without the GIL. This requires users to protect concurrent access of mutatable Python objects (eg lists) with locks at the Python level (something you should probably do anyway). The advantage is that there is less of a performance hit for non-threaded code, because the VM does not need to constantly release/acquire the GIL. In the future the GIL will be made more efficient. There is also room to improve the efficiency of non-GIL code by not using mutex's if there is only one thread active.
1 parent 520f356 commit 3096928

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

unix/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ CFLAGS_MOD += -DMICROPY_PY_SOCKET=1
9494
SRC_MOD += modsocket.c
9595
endif
9696
ifeq ($(MICROPY_PY_THREAD),1)
97-
CFLAGS_MOD += -DMICROPY_PY_THREAD=1
97+
CFLAGS_MOD += -DMICROPY_PY_THREAD=1 -DMICROPY_PY_THREAD_GIL=0
9898
LDFLAGS_MOD += -lpthread
9999
endif
100100

0 commit comments

Comments
 (0)