Skip to content

Commit 182a873

Browse files
authored
Rework handling of ctrl-c interrupt
1 parent 0b52359 commit 182a873

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

supervisor/shared/tick.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ void mp_hal_delay_ms(mp_uint_t delay) {
102102
while (remaining > 0) {
103103
RUN_BACKGROUND_TASKS;
104104
// Check to see if we've been CTRL-Ced by autoreload or the user.
105-
if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)) ||
106-
MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)) ||
107-
WATCHDOG_EXCEPTION_CHECK()) {
108-
if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)))
105+
if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)))
109106
{
110107
// clear exception and generate stacktrace
111108
MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL;
112109
nlr_raise(mp_obj_new_exception(&mp_type_KeyboardInterrupt));
113-
}
110+
}
111+
if( MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)) ||
112+
WATCHDOG_EXCEPTION_CHECK()) {
113+
// stop sleeping immediately
114114
break;
115115
}
116116
remaining = end_tick - port_get_raw_ticks(NULL);

0 commit comments

Comments
 (0)