summaryrefslogtreecommitdiff
path: root/py/mpstate.h
diff options
context:
space:
mode:
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 824aba1ff..18bec09e4 100644
--- a/py/mpstate.h
+++ b/py/mpstate.h
@@ -201,6 +201,11 @@ extern mp_state_ctx_t mp_state_ctx;
#define MP_STATE_VM(x) (mp_state_ctx.vm.x)
#define MP_STATE_MEM(x) (mp_state_ctx.mem.x)
+#if MICROPY_PY_THREAD
+extern mp_state_thread_t *mp_thread_get_state(void);
+#define MP_STATE_THREAD(x) (mp_thread_get_state()->x)
+#else
#define MP_STATE_THREAD(x) (mp_state_ctx.thread.x)
+#endif
#endif // __MICROPY_INCLUDED_PY_MPSTATE_H__