summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-05-27 13:44:55 +0100
committerDamien George <damien.p.george@gmail.com>2016-06-28 11:28:50 +0100
commite90b6ce0b5af51ef195aa98dad35a185b77c5075 (patch)
tree9982af1203416b3cfc51df6e0185aae954efe910
parent94d2919b7798e121e9266a6b2970e16b36339b2c (diff)
downloadmicropython-e90b6ce0b5af51ef195aa98dad35a185b77c5075.tar.gz
micropython-e90b6ce0b5af51ef195aa98dad35a185b77c5075.zip
py/mpthread.h: Move GIL macros outside MICROPY_PY_THREAD block.
The GIL macros are needed even if threading is not enabled.
-rw-r--r--py/mpthread.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/py/mpthread.h b/py/mpthread.h
index 747de60fef..75e8984ba6 100644
--- a/py/mpthread.h
+++ b/py/mpthread.h
@@ -38,14 +38,6 @@
struct _mp_state_thread_t;
-#if MICROPY_PY_THREAD_GIL
-#define MP_THREAD_GIL_ENTER() mp_thread_mutex_lock(&MP_STATE_VM(gil_mutex), 1)
-#define MP_THREAD_GIL_EXIT() mp_thread_mutex_unlock(&MP_STATE_VM(gil_mutex))
-#else
-#define MP_THREAD_GIL_ENTER()
-#define MP_THREAD_GIL_EXIT()
-#endif
-
struct _mp_state_thread_t *mp_thread_get_state(void);
void mp_thread_set_state(void *state);
void mp_thread_create(void *(*entry)(void*), void *arg, size_t stack_size);
@@ -57,4 +49,12 @@ void mp_thread_mutex_unlock(mp_thread_mutex_t *mutex);
#endif // MICROPY_PY_THREAD
+#if MICROPY_PY_THREAD && MICROPY_PY_THREAD_GIL
+#define MP_THREAD_GIL_ENTER() mp_thread_mutex_lock(&MP_STATE_VM(gil_mutex), 1)
+#define MP_THREAD_GIL_EXIT() mp_thread_mutex_unlock(&MP_STATE_VM(gil_mutex))
+#else
+#define MP_THREAD_GIL_ENTER()
+#define MP_THREAD_GIL_EXIT()
+#endif
+
#endif // __MICROPY_INCLUDED_PY_MPTHREAD_H__