Skip to content

Commit 2cfbe5b

Browse files
committed
esp32/modmachine: Release the GIL in machine.idle().
So that other threads get a chance to run when taskYIELD() is called. See issue micropython#5344. Signed-off-by: Damien George <damien@micropython.org>
1 parent 6bc50c4 commit 2cfbe5b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ports/esp32/modmachine.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ STATIC mp_obj_t machine_unique_id(void) {
232232
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_unique_id_obj, machine_unique_id);
233233

234234
STATIC mp_obj_t machine_idle(void) {
235+
MP_THREAD_GIL_EXIT();
235236
taskYIELD();
237+
MP_THREAD_GIL_ENTER();
236238
return mp_const_none;
237239
}
238240
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_idle_obj, machine_idle);

0 commit comments

Comments
 (0)