Skip to content

Commit a1c93a6

Browse files
committed
py: Don't use gc or qstr mutex when the GIL is enabled.
There is no need since the GIL already makes gc and qstr operations atomic.
1 parent 4cec63a commit a1c93a6

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

py/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
#define FTB_CLEAR(block) do { MP_STATE_MEM(gc_finaliser_table_start)[(block) / BLOCKS_PER_FTB] &= (~(1 << ((block) & 7))); } while (0)
9595
#endif
9696

97-
#if MICROPY_PY_THREAD
97+
#if MICROPY_PY_THREAD && !MICROPY_PY_THREAD_GIL
9898
#define GC_ENTER() mp_thread_mutex_lock(&MP_STATE_MEM(gc_mutex), 1)
9999
#define GC_EXIT() mp_thread_mutex_unlock(&MP_STATE_MEM(gc_mutex))
100100
#else

py/qstr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
#error unimplemented qstr length decoding
7373
#endif
7474

75-
#if MICROPY_PY_THREAD
75+
#if MICROPY_PY_THREAD && !MICROPY_PY_THREAD_GIL
7676
#define QSTR_ENTER() mp_thread_mutex_lock(&MP_STATE_VM(qstr_mutex), 1)
7777
#define QSTR_EXIT() mp_thread_mutex_unlock(&MP_STATE_VM(qstr_mutex))
7878
#else

0 commit comments

Comments
 (0)