canio: Run background tasks while waiting for message reception

Closes: #5004
This commit is contained in:
Jeff Epler 2021-08-18 11:35:06 -05:00 committed by Jeff Epler
parent 6ea136987e
commit 371f166de1
1 changed files with 5 additions and 0 deletions

View File

@ -151,6 +151,11 @@ mp_obj_t common_hal_canio_listener_receive(canio_listener_obj_t *self) {
if (supervisor_ticks_ms64() > deadline) { if (supervisor_ticks_ms64() > deadline) {
return NULL; return NULL;
} }
RUN_BACKGROUND_TASKS;
// Allow user to break out of a timeout with a KeyboardInterrupt.
if (mp_hal_is_interrupted()) {
return NULL;
}
} while (!common_hal_canio_listener_in_waiting(self)); } while (!common_hal_canio_listener_in_waiting(self));
} }