mirror of
https://github.com/janet-lang/janet
synced 2024-12-23 23:10:26 +00:00
Use pthread_sigmask when adding signal handlers.
This commit is contained in:
parent
f45571033c
commit
08e20e912d
@ -815,7 +815,11 @@ static void janet_signal_callback(JanetEVGenericMessage msg) {
|
|||||||
sigset_t set;
|
sigset_t set;
|
||||||
sigemptyset(&set);
|
sigemptyset(&set);
|
||||||
sigaddset(&set, sig);
|
sigaddset(&set, sig);
|
||||||
|
#ifdef JANET_THREADS
|
||||||
|
pthread_sigmask(SIG_BLOCK, &set, NULL);
|
||||||
|
#else
|
||||||
sigprocmask(SIG_BLOCK, &set, NULL);
|
sigprocmask(SIG_BLOCK, &set, NULL);
|
||||||
|
#endif
|
||||||
raise(sig);
|
raise(sig);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -881,6 +885,14 @@ JANET_CORE_FN(os_sigaction,
|
|||||||
}
|
}
|
||||||
action.sa_mask = mask;
|
action.sa_mask = mask;
|
||||||
RETRY_EINTR(rc, sigaction(sig, &action, NULL));
|
RETRY_EINTR(rc, sigaction(sig, &action, NULL));
|
||||||
|
sigset_t set;
|
||||||
|
sigemptyset(&set);
|
||||||
|
sigaddset(&set, sig);
|
||||||
|
#ifdef JANET_THREADS
|
||||||
|
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
|
||||||
|
#else
|
||||||
|
sigprocmask(SIG_UNBLOCK, &set, NULL);
|
||||||
|
#endif
|
||||||
return janet_wrap_nil();
|
return janet_wrap_nil();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user