summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--ports/unix/unix_mphal.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ports/unix/unix_mphal.c b/ports/unix/unix_mphal.c
index 3e14409efb..25d1b022db 100644
--- a/ports/unix/unix_mphal.c
+++ b/ports/unix/unix_mphal.c
@@ -41,6 +41,11 @@
STATIC void sighandler(int signum) {
if (signum == SIGINT) {
#if MICROPY_ASYNC_KBD_INTR
+ #if MICROPY_PY_THREAD_GIL
+ // Since signals can occur at any time, we may not be holding the GIL when
+ // this callback is called, so it is not safe to raise an exception here
+ #error "MICROPY_ASYNC_KBD_INTR and MICROPY_PY_THREAD_GIL are not compatible"
+ #endif
mp_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)));
sigset_t mask;
sigemptyset(&mask);