Skip to content

Commit 2c2c915

Browse files
committed
uselect: Allow interrupting poll with ctrl-c
1 parent 452ebe2 commit 2c2c915

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

extmod/moduselect.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "py/stream.h"
1717
#include "py/mperrno.h"
1818
#include "py/mphal.h"
19+
#include "shared/runtime/interrupt_char.h"
1920

2021
// Flags for poll()
2122
#define FLAG_ONESHOT (1)
@@ -230,6 +231,9 @@ STATIC mp_uint_t poll_poll_internal(uint n_args, const mp_obj_t *args) {
230231
break;
231232
}
232233
RUN_BACKGROUND_TASKS;
234+
if (mp_hal_is_interrupted()) {
235+
return 0;
236+
}
233237
}
234238

235239
return n_ready;

0 commit comments

Comments
 (0)