uselect: Allow interrupting poll with ctrl-c

This commit is contained in:
Jeff Epler 2022-11-05 11:33:47 -05:00
parent 452ebe27ae
commit 2c2c9153ec
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
1 changed files with 4 additions and 0 deletions

View File

@ -16,6 +16,7 @@
#include "py/stream.h"
#include "py/mperrno.h"
#include "py/mphal.h"
#include "shared/runtime/interrupt_char.h"
// Flags for poll()
#define FLAG_ONESHOT (1)
@ -230,6 +231,9 @@ STATIC mp_uint_t poll_poll_internal(uint n_args, const mp_obj_t *args) {
break;
}
RUN_BACKGROUND_TASKS;
if (mp_hal_is_interrupted()) {
return 0;
}
}
return n_ready;