esp32/modmachine: Release the GIL in machine.idle().

So that other threads get a chance to run when taskYIELD() is called.

See issue #5344.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2021-07-21 01:32:15 +10:00
parent 6bc50c4fa9
commit 2cfbe5bc0f

View File

@ -232,7 +232,9 @@ STATIC mp_obj_t machine_unique_id(void) {
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_unique_id_obj, machine_unique_id);
STATIC mp_obj_t machine_idle(void) {
MP_THREAD_GIL_EXIT();
taskYIELD();
MP_THREAD_GIL_ENTER();
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_idle_obj, machine_idle);