From 97eb64546a2d4e9bc13c104165e06cf7db91341c Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 13 Feb 2024 16:35:28 +0900 Subject: [PATCH] ports/unix/unix_mphal.c: Disable signal mask stuff for WASI. WASI dosen't have signals. Signed-off-by: YAMAMOTO Takashi --- ports/unix/unix_mphal.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ports/unix/unix_mphal.c b/ports/unix/unix_mphal.c index 24c0fa3cda..a8d8c573d3 100644 --- a/ports/unix/unix_mphal.c +++ b/ports/unix/unix_mphal.c @@ -43,7 +43,13 @@ #endif #endif -#ifndef _WIN32 +#if defined(_WIN32) || defined(__wasi__) +#define HAS_SIGNAL 0 +#else +#define HAS_SIGNAL 1 +#endif + +#if HAS_SIGNAL != 0 #include STATIC void sighandler(int signum) { @@ -75,7 +81,7 @@ STATIC void sighandler(int signum) { void mp_hal_set_interrupt_char(char c) { // configure terminal settings to (not) let ctrl-C through if (c == CHAR_CTRL_C) { - #ifndef _WIN32 + #if HAS_SIGNAL != 0 // enable signal handler struct sigaction sa; sa.sa_flags = 0; @@ -84,7 +90,7 @@ void mp_hal_set_interrupt_char(char c) { sigaction(SIGINT, &sa, NULL); #endif } else { - #ifndef _WIN32 + #if HAS_SIGNAL != 0 // disable signal handler struct sigaction sa; sa.sa_flags = 0;