diff --git a/ports/windows/mpconfigport.h b/ports/windows/mpconfigport.h index 2e1521b9c7..e615fe8502 100644 --- a/ports/windows/mpconfigport.h +++ b/ports/windows/mpconfigport.h @@ -227,14 +227,11 @@ typedef long mp_off_t; #include "sleep.h" #if MICROPY_ENABLE_SCHEDULER -// Use 1mSec sleep to make sure there is effectively a wait period: +// Use minimum 1mSec sleep to make sure there is effectively a wait period: // something like usleep(500) truncates and ends up calling Sleep(0). -#define MICROPY_EVENT_POLL_HOOK \ - do { \ - extern void mp_handle_pending(bool); \ - mp_handle_pending(true); \ - msec_sleep(1.0); \ - } while (0); +#define MICROPY_INTERNAL_WFE(TIMEOUT_MS) msec_sleep(MAX(1.0, (double)(TIMEOUT_MS))) +#else +#define MICROPY_INTERNAL_WFE(TIMEOUT_MS) /* No-op */ #endif #ifdef __GNUC__