mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
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:
@@ -91,6 +91,12 @@ void mp_init(void) {
|
||||
// start with no extensions to builtins
|
||||
MP_STATE_VM(mp_module_builtins_override_dict) = NULL;
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_THREAD_GIL
|
||||
mp_thread_mutex_init(&MP_STATE_VM(gil_mutex));
|
||||
#endif
|
||||
|
||||
MP_THREAD_GIL_ENTER();
|
||||
}
|
||||
|
||||
void mp_deinit(void) {
|
||||
|
||||
Reference in New Issue
Block a user