py: Implement a simple global interpreter lock.

This makes the VM/runtime thread safe, at the cost of not being able to
run code in parallel.
This commit is contained in:
Damien George
2016-05-26 10:42:53 +00:00
parent 1f54ad2aed
commit 4cec63a9db
6 changed files with 35 additions and 0 deletions

View File

@@ -829,6 +829,12 @@ typedef double mp_float_t;
#define MICROPY_PY_THREAD (0)
#endif
// Whether to make the VM/runtime thread-safe using a global lock
// If not enabled then thread safety must be provided at the Python level
#ifndef MICROPY_PY_THREAD_GIL
#define MICROPY_PY_THREAD_GIL (MICROPY_PY_THREAD)
#endif
// Extended modules
#ifndef MICROPY_PY_UCTYPES