unix, windows: Use mp_keyboard_interrupt instead of custom code.
The mp_keyboard_interrupt() function does exactly what is needed here, and using it gets ctrl-C working when MICROPY_ENABLE_SCHEDULER is enabled on these ports (and MICROPY_ASYNC_KBD_INTR is disabled).
This commit is contained in:
parent
abe2caf6df
commit
046ae80bdf
|
@ -58,8 +58,7 @@ STATIC void sighandler(int signum) {
|
||||||
// this is the second time we are called, so die straight away
|
// this is the second time we are called, so die straight away
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
mp_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)));
|
mp_keyboard_interrupt();
|
||||||
MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "py/mpstate.h"
|
#include "py/runtime.h"
|
||||||
#include "py/mphal.h"
|
#include "py/mphal.h"
|
||||||
#include "py/mpthread.h"
|
#include "py/mpthread.h"
|
||||||
|
|
||||||
|
@ -84,8 +84,7 @@ BOOL WINAPI console_sighandler(DWORD evt) {
|
||||||
// this is the second time we are called, so die straight away
|
// this is the second time we are called, so die straight away
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
mp_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)));
|
mp_keyboard_interrupt();
|
||||||
MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception));
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in New Issue