windows: Implement MICROPY_INTERNAL_WFE() macro.
This should be the equivalent of the previous event poll hook macro. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
parent
393938b3e6
commit
c393f5c123
|
@ -227,14 +227,11 @@ typedef long mp_off_t;
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
|
|
||||||
#if MICROPY_ENABLE_SCHEDULER
|
#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).
|
// something like usleep(500) truncates and ends up calling Sleep(0).
|
||||||
#define MICROPY_EVENT_POLL_HOOK \
|
#define MICROPY_INTERNAL_WFE(TIMEOUT_MS) msec_sleep(MAX(1.0, (double)(TIMEOUT_MS)))
|
||||||
do { \
|
#else
|
||||||
extern void mp_handle_pending(bool); \
|
#define MICROPY_INTERNAL_WFE(TIMEOUT_MS) /* No-op */
|
||||||
mp_handle_pending(true); \
|
|
||||||
msec_sleep(1.0); \
|
|
||||||
} while (0);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
|
Loading…
Reference in New Issue