summaryrefslogtreecommitdiffstatshomepage
path: root/unix
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-07-09 16:48:06 +0100
committerDamien George <damien.p.george@gmail.com>2016-07-09 16:48:06 +0100
commit3096928d5ab6544c3f85639e1b97ac2cefcc2a74 (patch)
treebc18eefbf0a5b141847cf2a11aaf4c43528075c9 /unix
parent520f35632d78e1b73f647d993205aade0de8b1ce (diff)
downloadmicropython-3096928d5ab6544c3f85639e1b97ac2cefcc2a74.tar.gz
micropython-3096928d5ab6544c3f85639e1b97ac2cefcc2a74.zip
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.
Diffstat (limited to 'unix')
-rw-r--r--unix/Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/unix/Makefile b/unix/Makefile
index fd1c1999dd..2e0cbfd35a 100644
--- a/unix/Makefile
+++ b/unix/Makefile
@@ -94,7 +94,7 @@ CFLAGS_MOD += -DMICROPY_PY_SOCKET=1
SRC_MOD += modsocket.c
endif
ifeq ($(MICROPY_PY_THREAD),1)
-CFLAGS_MOD += -DMICROPY_PY_THREAD=1
+CFLAGS_MOD += -DMICROPY_PY_THREAD=1 -DMICROPY_PY_THREAD_GIL=0
LDFLAGS_MOD += -lpthread
endif