aboutsummaryrefslogtreecommitdiff
path: root/py/mpstate.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-05-26 10:42:53 +0000
committerDamien George <damien.p.george@gmail.com>2016-06-28 11:28:50 +0100
commit4cec63a9dbed86c4332b9e7fcd56d092046193e4 (patch)
tree9e5e0636411f5de6647d4021c8069a39cb031f14 /py/mpstate.h
parent1f54ad2aed0dc8f2d868ccd89ccf639a475e8022 (diff)
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.
Diffstat (limited to 'py/mpstate.h')
-rw-r--r--py/mpstate.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/mpstate.h b/py/mpstate.h
index 3ee243dff..b79fd7c5c 100644
--- a/py/mpstate.h
+++ b/py/mpstate.h
@@ -175,6 +175,11 @@ typedef struct _mp_state_vm_t {
#if MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF && MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE == 0
mp_int_t mp_emergency_exception_buf_size;
#endif
+
+ #if MICROPY_PY_THREAD_GIL
+ // This is a global mutex used to make the VM/runtime thread-safe.
+ mp_thread_mutex_t gil_mutex;
+ #endif
} mp_state_vm_t;
// This structure holds state that is specific to a given thread.