You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While debugging #5344 I encounted a situation where utime.sleep_ms(0) did not free the GIL to another thread. This is because utime.sleep_ms(0) is a useless invocation that does nothing.
STATIC mp_obj_t time_sleep_ms(mp_obj_t arg) {
mp_int_t ms = mp_obj_get_int(arg);
if (ms > 0) {
mp_hal_delay_ms(ms);
}
return mp_const_none;
}
I propose that at the very least this function calls MICROPY_EVENT_POLL_HOOK when ms is zero, and at best, always calls mp_hal_delay_ms. I don't believe zero should be a special case.
The text was updated successfully, but these errors were encountered:
While debugging #5344 I encounted a situation where
utime.sleep_ms(0)
did not free the GIL to another thread. This is becauseutime.sleep_ms(0)
is a useless invocation that does nothing.micropython/extmod/utime_mphal.c
Line 51 in b9ec603
I propose that at the very least this function calls
MICROPY_EVENT_POLL_HOOK
whenms
is zero, and at best, always callsmp_hal_delay_ms
. I don't believe zero should be a special case.The text was updated successfully, but these errors were encountered: