diff options
| author | David Lechner <david@pybricks.com> | 2021-05-10 21:53:22 -0500 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-06-19 09:43:44 +1000 |
| commit | ca920f72184c50f61002aa9d5cd01555b1e28b7b (patch) | |
| tree | a46b6cb9c91a275015b351443d1cb1181d8c5d14 /py/mpstate.h | |
| parent | 7c51cb2307eaca1a1ccc071e0bb5eb4a5f734610 (diff) | |
py/mpstate: Make exceptions thread-local.
This moves mp_pending_exception from mp_state_vm_t to mp_state_thread_t.
This allows exceptions to be scheduled on a specific thread.
Signed-off-by: David Lechner <david@pybricks.com>
Diffstat (limited to 'py/mpstate.h')
| -rw-r--r-- | py/mpstate.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/py/mpstate.h b/py/mpstate.h index a0e3d4f14..f5fb5b707 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -137,9 +137,6 @@ typedef struct _mp_state_vm_t { // dictionary with loaded modules (may be exposed as sys.modules) mp_obj_dict_t mp_loaded_modules_dict; - // pending exception object (MP_OBJ_NULL if not pending) - volatile mp_obj_t mp_pending_exception; - #if MICROPY_ENABLE_SCHEDULER mp_sched_item_t sched_queue[MICROPY_SCHEDULER_DEPTH]; #endif @@ -266,6 +263,9 @@ typedef struct _mp_state_thread_t { nlr_buf_t *nlr_top; + // pending exception object (MP_OBJ_NULL if not pending) + volatile mp_obj_t mp_pending_exception; + #if MICROPY_PY_SYS_SETTRACE mp_obj_t prof_trace_callback; bool prof_callback_is_executing; |
