unix/unix_mphal: Add compile check for incompatible GIL+ASYNC_KBD_INTR.

It is not safe to enable MICROPY_ASYNC_KBD_INTR and MICROPY_PY_THREAD_GIL
at the same time.  This will trigger a compiler error to ensure that it
is not possible to make this mistake.
pull/5585/head
David Lechner 2020-01-23 14:11:13 -06:00 zatwierdzone przez Damien George
rodzic bc3499f010
commit d89ed3e62b
1 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -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);