mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-30 14:53:11 +00:00
Make set_signal_observed thread-safe
This commit is contained in:
parent
c566756f3b
commit
ead16958b2
1 changed files with 2 additions and 2 deletions
|
@ -87,9 +87,9 @@ static pending_signals_t s_pending_signals;
|
||||||
static event_handler_list_t s_event_handlers;
|
static event_handler_list_t s_event_handlers;
|
||||||
|
|
||||||
/// Variables (one per signal) set when a signal is observed. This is inspected by a signal handler.
|
/// Variables (one per signal) set when a signal is observed. This is inspected by a signal handler.
|
||||||
static volatile bool s_observed_signals[NSIG] = {};
|
static volatile sig_atomic_t s_observed_signals[NSIG] = {};
|
||||||
|
|
||||||
static void set_signal_observed(int sig, bool val) {
|
static void set_signal_observed(int sig, bool val) {
|
||||||
ASSERT_IS_MAIN_THREAD();
|
|
||||||
if (sig >= 0 && (size_t)sig < sizeof s_observed_signals / sizeof *s_observed_signals) {
|
if (sig >= 0 && (size_t)sig < sizeof s_observed_signals / sizeof *s_observed_signals) {
|
||||||
s_observed_signals[sig] = val;
|
s_observed_signals[sig] = val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue