unix: Update port to use the new event functions.

Necessary to get coverage of the new event functions.

Deletes the case that called usleep(delay) for mp_hal_delay_ms(), it seems
like this wouldn't have ever happened anyhow (MICROPY_EVENT_POOL_HOOK is
always defined for the unix port).

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
Angus Gratton
2023-12-07 13:32:41 +11:00
committed by Damien George
parent 73879734d9
commit 2c828a8815
3 changed files with 8 additions and 18 deletions

View File

@@ -578,9 +578,10 @@ STATIC mp_obj_t extra_coverage(void) {
mp_sched_unlock();
mp_printf(&mp_plat_print, "unlocked\n");
// drain pending callbacks
// drain pending callbacks, and test mp_event_wait_indefinite(), mp_event_wait_ms()
mp_event_wait_indefinite(); // the unix port only waits 500us in this call
while (mp_sched_num_pending()) {
mp_handle_pending(true);
mp_event_wait_ms(1);
}
// setting the keyboard interrupt and raising it during mp_handle_pending