On 2026-04-03 11:26, Paul Eggert wrote:
the identifier is spelled GNULIB_SIGPROCMASK_SINGLE_THREAD not
GNULIB_SIGACTION_SINGLE_THREAD. I plan to change gzip etc. accordingly.
When fixing this in gzip I noticed that the locking code in Gnulib's
sigprocmask module is no longer necessary and in some sense is now
misleading, now that Gnulib avoids callng sigprocmask from multithreaded
processes and documents that sigprocmask is limited in that way. So I
moved the locking to the pthread_sigmask module where POSIX suggests it
belogs, and renamed the identifier to
GNULIB_PTHREAD_SIGMASK_SINGLE_THREAD. Since no GNU apps use the old
identifier this should be safe.
Some of the sigpromask-related FIXMEs still remained in the fatal-signal
and term-style-control modules, so I attempted to fix them too.
All done via the attached patches.
From 12a30be76fb2d1f49e00fb7140194800cdea2122 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Sun, 5 Apr 2026 11:25:05 -0700
Subject: [PATCH 1/4] pthread_sigmask: lock here, not in sigprocmask
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since sigprocmask should now be used only in single-threaded processes,
move the locking from lib/sigprocmask.c to lib/pthread_sigmask.c.
* lib/pthread_sigmask.c: If !HAVE_SIGPROCMASK &&
!GNULIB_PTHREAD_SIGMASK_SINGLE_THREAD, replace Gnulib sigprocmask
with a thread-safe subsitute sigprocmask_r.
Include glthread/lock.h to implement this.
* lib/sigprocmask.c (gl_lock_define_initialized, gl_lock_lock)
(gl_lock_unlock, sig_lock): Remove. All uses removed.
Do not include glthread/lock.h.
* m4/signalblocking.m4 (gl_SIGNALBLOCKING):
Define HAVE_SIGPROCMASK, for the benefit of pthread_sigmask.c.
* modules/pthread_sigmask (Depends-on): Add ‘lock’.
* modules/sigprocmask (Depends-on): Remove ‘lock’.
---
ChangeLog | 17 +++++++++++++++++
doc/multithread.texi | 6 +++---
doc/posix-functions/pthread_sigmask.texi | 8 ++++++++
doc/posix-functions/sigprocmask.texi | 20 +++++++++-----------
lib/pthread_sigmask.c | 20 ++++++++++++++++++++
lib/sigprocmask.c | 23 +----------------------
m4/signalblocking.m4 | 8 ++++----
modules/pthread_sigmask | 1 +
modules/sigprocmask | 1 -
9 files changed, 63 insertions(+), 41 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9586cedb01..f2e6c074cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2026-04-05 Paul Eggert <[email protected]>
+
+ pthread_sigmask: lock here, not in sigprocmask
+ Since sigprocmask should now be used only in single-threaded processes,
+ move the locking from lib/sigprocmask.c to lib/pthread_sigmask.c.
+ * lib/pthread_sigmask.c: If !HAVE_SIGPROCMASK &&
+ !GNULIB_PTHREAD_SIGMASK_SINGLE_THREAD, replace Gnulib sigprocmask
+ with a thread-safe subsitute sigprocmask_r.
+ Include glthread/lock.h to implement this.
+ * lib/sigprocmask.c (gl_lock_define_initialized, gl_lock_lock)
+ (gl_lock_unlock, sig_lock): Remove. All uses removed.
+ Do not include glthread/lock.h.
+ * m4/signalblocking.m4 (gl_SIGNALBLOCKING):
+ Define HAVE_SIGPROCMASK, for the benefit of pthread_sigmask.c.
+ * modules/pthread_sigmask (Depends-on): Add ‘lock’.
+ * modules/sigprocmask (Depends-on): Remove ‘lock’.
+
2026-04-05 Pádraig Brady <[email protected]>
mcel: remove forced use of GLIBC's mbrtoc32
diff --git a/doc/multithread.texi b/doc/multithread.texi
index 63387874f7..d86da6d340 100644
--- a/doc/multithread.texi
+++ b/doc/multithread.texi
@@ -323,9 +323,9 @@ This macro optimizes the functions @code{mbrtowc}, @code{mbrtoc32}, and
You can get this macro defined by including the Gnulib module
@code{wchar-single}.
@item
-You may define the C macro @code{GNULIB_SIGPROCMASK_SINGLE_THREAD}, if all the
-programs in your package invoke the functions of the @code{sigprocmask} module
-only from a single thread.
+You may define the C macro @code{GNULIB_PTHREAD_SIGMASK_SINGLE_THREAD}
+if all the programs in your package invoke @code{pthread_sigmask} only
+from a single thread.
@item
You may define the C macro @code{GNULIB_EXCLUDE_SINGLE_THREAD}, if all the
programs in your package invoke the functions of the @code{exclude} module
diff --git a/doc/posix-functions/pthread_sigmask.texi b/doc/posix-functions/pthread_sigmask.texi
index 8772168d0a..916f0c296c 100644
--- a/doc/posix-functions/pthread_sigmask.texi
+++ b/doc/posix-functions/pthread_sigmask.texi
@@ -37,4 +37,12 @@ Portability problems not fixed by Gnulib:
@item
On platforms that do not natively support this function,
it has unspecified behavior in a multi-threaded process.
+For example, the Gnulib replacement on native MS-Windows can affect
+the signal masks of other threads, which can lead to race conditions.
+
+@item
+The Gnulib replacement on native MS-Windows is not async-signal-safe
+(see
+@url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_04_03,
+POSIX section ``Signal Actions''}).
@end itemize
diff --git a/doc/posix-functions/sigprocmask.texi b/doc/posix-functions/sigprocmask.texi
index 165baa5580..3f976c9876 100644
--- a/doc/posix-functions/sigprocmask.texi
+++ b/doc/posix-functions/sigprocmask.texi
@@ -27,20 +27,18 @@ unspecified behavior so @code{pthread_sigmask} should be used instead.
On most platforms, @code{sigprocmask} is essentially equivalent to
@code{pthread_sigmask}, with only a difference regarding the error
return convention.
-However, on Darwin-based systems such as macOS, @code{sigprocmask} can
-affect the signal masks of other threads, and this discrepancy can
-lead to race conditions, e.g., if some threads use @code{sigprocmask}
-while others use @code{pthread_sigmask}.
+However, on macOS and on the Gnulib replacement on native MS-Windows,
+@code{sigprocmask} can affect the signal masks of other threads,
+which can lead to race conditions.
+
+@item
+The Gnulib replacement on native MS-Windows is not async-signal-safe
+(see
+@url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_04_03,
+POSIX section ``Signal Actions''}).
@end itemize
Note: In single-threaded applications it's simpler to use
@code{sigprocmask}, since it does not require compiling with
@code{-pthread} and/or linking with @code{-lpthread} on some platforms:
AIX.
-
-Note: While on POSIX platforms, @code{sigprocmask} is multithread-safe
-and async-signal-safe (see
-@url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_04_03,
-POSIX section ``Signal Actions''}),
-the gnulib replacement on native Windows is only multithread-safe,
-not async-signal-safe.
diff --git a/lib/pthread_sigmask.c b/lib/pthread_sigmask.c
index 5d40fc7b1a..242664c104 100644
--- a/lib/pthread_sigmask.c
+++ b/lib/pthread_sigmask.c
@@ -26,6 +26,26 @@
# include <string.h>
#endif
+#if !HAVE_SIGPROCMASK && !GNULIB_PTHREAD_SIGMASK_SINGLE_THREAD
+# include "glthread/lock.h"
+
+gl_lock_define_initialized (static, sig_lock)
+
+/* A thread-safe variant of the Gnulib sigprocmask substitute.
+ Unfortunately it still has undesirable effects in multithreaded processes,
+ as it can stomp on other threads' signal masks. */
+static int
+sigprocmask_r (int how, sigset_t const *new_mask, sigset_t *old_mask)
+{
+ gl_lock_lock (sig_lock);
+ int ret = sigprocmask (how, new_mask, old_mask);
+ gl_lock_unlock (sig_lock);
+ return ret;
+}
+# undef sigprocmask
+# define sigprocmask sigprocmask_r
+#endif
+
int
pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
#undef pthread_sigmask
diff --git a/lib/sigprocmask.c b/lib/sigprocmask.c
index 7866dbed59..6f24fe4f39 100644
--- a/lib/sigprocmask.c
+++ b/lib/sigprocmask.c
@@ -24,14 +24,6 @@
#include <stdint.h>
#include <stdlib.h>
-#if GNULIB_SIGPROCMASK_SINGLE_THREAD
-# define gl_lock_define_initialized(storageclass,name)
-# define gl_lock_lock(lock)
-# define gl_lock_unlock(lock)
-#else
-# include "glthread/lock.h"
-#endif
-
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
# include "msvc-inval.h"
#endif
@@ -92,10 +84,6 @@ signal_nothrow (int sig, handler_t handler)
# define signal signal_nothrow
#endif
-/* This lock protects the variables defined in this file from concurrent
- modification in multiple threads. */
-gl_lock_define_initialized(static, sig_lock)
-
/* Handling of gnulib defined signals. */
#if GNULIB_defined_SIGPIPE
@@ -232,8 +220,6 @@ static volatile handler_t old_handlers[NSIG];
int
sigprocmask (int operation, const sigset_t *set, sigset_t *old_set)
{
- gl_lock_lock (sig_lock);
-
if (old_set != NULL)
*old_set = blocked_set;
@@ -252,7 +238,6 @@ sigprocmask (int operation, const sigset_t *set, sigset_t *old_set)
new_blocked_set = blocked_set & ~*set;
break;
default:
- gl_lock_unlock (sig_lock);
errno = EINVAL;
return -1;
}
@@ -294,7 +279,6 @@ sigprocmask (int operation, const sigset_t *set, sigset_t *old_set)
}
}
- gl_lock_unlock (sig_lock);
return 0;
}
@@ -343,16 +327,11 @@ rpl_signal (int sig, handler_t handler)
int
_gl_raise_SIGPIPE (void)
{
- gl_lock_lock (sig_lock);
if (blocked_set & (1U << SIGPIPE))
- {
- pending_array[SIGPIPE] = 1;
- gl_lock_unlock (sig_lock);
- }
+ pending_array[SIGPIPE] = 1;
else
{
handler_t handler = SIGPIPE_handler;
- gl_lock_unlock (sig_lock);
if (handler == SIG_DFL)
exit (128 + SIGPIPE);
else if (handler != SIG_IGN)
diff --git a/m4/signalblocking.m4 b/m4/signalblocking.m4
index 55a1495fba..afa8e56a71 100644
--- a/m4/signalblocking.m4
+++ b/m4/signalblocking.m4
@@ -1,5 +1,5 @@
# signalblocking.m4
-# serial 17
+# serial 18
dnl Copyright (C) 2001-2002, 2006-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -15,10 +15,10 @@ AC_DEFUN([gl_SIGNALBLOCKING],
[
AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T])
+ AC_CHECK_FUNCS_ONCE([sigprocmask])
HAVE_POSIX_SIGNALBLOCKING=0
- if test "$gl_cv_type_sigset_t" = yes; then
- AC_CHECK_FUNC([sigprocmask], [HAVE_POSIX_SIGNALBLOCKING=1])
- fi
+ AS_CASE([$gl_cv_type_sigset_t,$ac_cv_func_sigprocmask],
+ [yes,yes], [HAVE_POSIX_SIGNALBLOCKING=1])
])
# Prerequisites of lib/sigprocmask.c.
diff --git a/modules/pthread_sigmask b/modules/pthread_sigmask
index e014553005..27ba7031d5 100644
--- a/modules/pthread_sigmask
+++ b/modules/pthread_sigmask
@@ -9,6 +9,7 @@ Depends-on:
signal-h
threadlib
sigprocmask [test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1]
+lock [test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1]
memeq [test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1]
configure.ac:
diff --git a/modules/sigprocmask b/modules/sigprocmask
index 79e7c7302f..7f2e083803 100644
--- a/modules/sigprocmask
+++ b/modules/sigprocmask
@@ -8,7 +8,6 @@ m4/signalblocking.m4
Depends-on:
signal-h
stdint-h [test $HAVE_POSIX_SIGNALBLOCKING = 0]
-lock [test $HAVE_POSIX_SIGNALBLOCKING = 0]
raise [test $HAVE_POSIX_SIGNALBLOCKING = 0]
msvc-inval [test $HAVE_POSIX_SIGNALBLOCKING = 0]
--
2.51.0
From 1a914207cb714f1054a2eec48f1afd0faa7dbfe1 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Sun, 5 Apr 2026 11:26:56 -0700
Subject: [PATCH 2/4] sigaction: use pthread_sigmask
* lib/sigaction.c (sigaction_handler, sigaction):
Use pthread_sigmask, not sigprocmask.
* modules/sigaction (Depends-on):
Depend on pthread_sigmask, not on sigprocmask.
---
ChangeLog | 6 ++++++
doc/posix-functions/sigaction.texi | 11 +++++++++++
lib/sigaction.c | 22 ++++++++++++----------
modules/sigaction | 2 +-
4 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f2e6c074cd..b811f80713 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2026-04-05 Paul Eggert <[email protected]>
+ sigaction: use pthread_sigmask
+ * lib/sigaction.c (sigaction_handler, sigaction):
+ Use pthread_sigmask, not sigprocmask.
+ * modules/sigaction (Depends-on):
+ Depend on pthread_sigmask, not on sigprocmask.
+
pthread_sigmask: lock here, not in sigprocmask
Since sigprocmask should now be used only in single-threaded processes,
move the locking from lib/sigprocmask.c to lib/pthread_sigmask.c.
diff --git a/doc/posix-functions/sigaction.texi b/doc/posix-functions/sigaction.texi
index 65008cdb50..e2cfe30ac2 100644
--- a/doc/posix-functions/sigaction.texi
+++ b/doc/posix-functions/sigaction.texi
@@ -55,4 +55,15 @@ except that @code{SIG_IGN} for @code{SIGCHLD} has the effect that the children
execution times are not accounted in the @code{times} function.
On some platforms (BSD? SystemV? Linux?), you need to use the @code{sigaction}
flag @code{SA_NOCLDWAIT} in order to obtain this behavior.
+
+@item
+The Gnulib replacement on native MS-Windows can affect the signal
+masks of other threads, either when @code{sigaction} is called
+or when a signal handler is called, and this can lead to race conditions.
+
+@item
+The Gnulib replacement on native MS-Windows is not async-signal-safe
+(see
+@url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_04_03,
+POSIX section ``Signal Actions''}).
@end itemize
diff --git a/lib/sigaction.c b/lib/sigaction.c
index b9e6af4609..07efa9ea17 100644
--- a/lib/sigaction.c
+++ b/lib/sigaction.c
@@ -28,12 +28,14 @@
signal() has SysV semantics (ie. the handler is uninstalled before
it is invoked). This is an inherent data race if an asynchronous
signal is sent twice in a row before we can reinstall our handler,
- but there's nothing we can do about it. Meanwhile, sigprocmask()
+ but there's nothing we can do about it. Meanwhile, pthread_sigmask()
is not present, and while we can use the gnulib replacement to
provide critical sections, it too suffers from potential data races
in the face of an ill-timed asynchronous signal. And we compound
the situation by reading static storage in a signal handler, which
- POSIX warns is not generically async-signal-safe. Oh well.
+ POSIX warns is not generically async-signal-safe. Furthermore, the
+ replacement pthread_sigmask can stomp on other threads' signal masks,
+ which can lead to other races. Oh well.
Additionally:
- We don't implement SA_NOCLDSTOP or SA_NOCLDWAIT, because SIGCHLD
@@ -47,7 +49,7 @@
POSIX states that an application should not mix signal() and
sigaction(). We support the use of signal() within the gnulib
- sigprocmask() substitute, but all other application code linked
+ pthread_sigmask() substitute, but all other application code linked
with this module should stick with only sigaction(). */
/* Check some of our assumptions. */
@@ -111,13 +113,13 @@ sigaction_handler (int sig)
if ((action_array[sig].sa_flags & SA_NODEFER) == 0)
sigaddset (&mask, sig);
sigset_t oldmask;
- sigprocmask (SIG_BLOCK, &mask, &oldmask);
+ pthread_sigmask (SIG_BLOCK, &mask, &oldmask);
/* Invoke the user's handler, then restore prior mask. */
errno = saved_errno;
handler (sig);
saved_errno = errno;
- sigprocmask (SIG_SETMASK, &oldmask, NULL);
+ pthread_sigmask (SIG_SETMASK, &oldmask, NULL);
errno = saved_errno;
}
@@ -145,16 +147,16 @@ sigaction (int sig, const struct sigaction *restrict act,
words, if an asynchronous signal can occur while we are anywhere
inside this function, the user's handler could then call
sigaction() recursively and expect consistent results. We meet
- this rule by using sigprocmask to block all signals before
+ this rule by using pthread_sigmask to block all signals before
modifying any data structure that could be read from a signal
- handler; this works since we know that the gnulib sigprocmask
+ handler; this works since we know that the gnulib pthread_sigmask
replacement does not try to use sigaction() from its handler. */
if (!act && !oact)
return 0;
sigset_t mask;
sigfillset (&mask);
sigset_t oldmask;
- sigprocmask (SIG_BLOCK, &mask, &oldmask);
+ pthread_sigmask (SIG_BLOCK, &mask, &oldmask);
if (oact)
{
if (action_array[sig].sa_handler)
@@ -189,13 +191,13 @@ sigaction (int sig, const struct sigaction *restrict act,
action_array[sig] = *act;
}
}
- sigprocmask (SIG_SETMASK, &oldmask, NULL);
+ pthread_sigmask (SIG_SETMASK, &oldmask, NULL);
return 0;
failure:
{
int saved_errno = errno;
- sigprocmask (SIG_SETMASK, &oldmask, NULL);
+ pthread_sigmask (SIG_SETMASK, &oldmask, NULL);
errno = saved_errno;
return -1;
}
diff --git a/modules/sigaction b/modules/sigaction
index af8761cdd9..b5ecafdea1 100644
--- a/modules/sigaction
+++ b/modules/sigaction
@@ -10,7 +10,7 @@ m4/sigaction.m4
Depends-on:
extern-inline
signal-h
-sigprocmask [test $HAVE_SIGACTION = 0]
+pthread_sigmask [test $HAVE_SIGACTION = 0]
configure.ac:
gl_SIGACTION
--
2.51.0
From a3a1e8974b95824f8421c669fe7d89227c426598 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Sun, 5 Apr 2026 11:28:19 -0700
Subject: [PATCH 3/4] fatal-signal: use pthread_sigmask
* lib/fatal-signal.c (block_fatal_signals)
(unblock_fatal_signals): Prefer pthread_sigmask to sigprocmask.
* modules/fatal-signal (Depends-on):
Depend on pthread_sigmask, not on sigprocmask.
---
ChangeLog | 6 ++++++
lib/fatal-signal.c | 10 ++--------
modules/fatal-signal | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b811f80713..44596007da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2026-04-05 Paul Eggert <[email protected]>
+ fatal-signal: use pthread_sigmask
+ * lib/fatal-signal.c (block_fatal_signals)
+ (unblock_fatal_signals): Prefer pthread_sigmask to sigprocmask.
+ * modules/fatal-signal (Depends-on):
+ Depend on pthread_sigmask, not on sigprocmask.
+
sigaction: use pthread_sigmask
* lib/sigaction.c (sigaction_handler, sigaction):
Use pthread_sigmask, not sigprocmask.
diff --git a/lib/fatal-signal.c b/lib/fatal-signal.c
index c4a8a36403..fcfde05253 100644
--- a/lib/fatal-signal.c
+++ b/lib/fatal-signal.c
@@ -311,10 +311,7 @@ block_fatal_signals (void)
if (fatal_signals_block_counter++ == 0)
{
init_fatal_signal_set ();
- /* FIXME: Use pthread_sigmask, not sigprocmask, as the two functions
- behave differently on macOS and the sigprocmask behavior can cause
- this thread to race with other threads in harmful ways. */
- sigprocmask (SIG_BLOCK, &fatal_signal_set, NULL);
+ pthread_sigmask (SIG_BLOCK, &fatal_signal_set, NULL);
}
if (mt) gl_lock_unlock (fatal_signals_block_lock);
@@ -335,10 +332,7 @@ unblock_fatal_signals (void)
if (--fatal_signals_block_counter == 0)
{
init_fatal_signal_set ();
- /* FIXME: Use pthread_sigmask, not sigprocmask, as the two functions
- behave differently on macOS and the sigprocmask behavior can cause
- this thread to race with other threads in harmful ways. */
- sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL);
+ pthread_sigmask (SIG_UNBLOCK, &fatal_signal_set, NULL);
}
if (mt) gl_lock_unlock (fatal_signals_block_lock);
diff --git a/modules/fatal-signal b/modules/fatal-signal
index ffc50ad64f..8741641bf5 100644
--- a/modules/fatal-signal
+++ b/modules/fatal-signal
@@ -15,7 +15,7 @@ sigaction
lock
once
thread-optim
-sigprocmask
+pthread_sigmask
raise
stdcountof-h
--
2.51.0
From 13d1e8d16ce3d4043584b88dca9a0afb0a75dcd0 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Sun, 5 Apr 2026 11:29:48 -0700
Subject: [PATCH 4/4] term-style-control: use pthread_sigmask
* lib/term-style-control.c (block_relevant_signals)
(unblock_relevant_signals): Prefer pthread_sigmask to sigprocmask.
* modules/term-style-control (Depends-on):
Depend on pthread_sigmask, not on sigprocmask.
---
ChangeLog | 6 ++++++
lib/term-style-control.c | 10 ++--------
modules/term-style-control | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 44596007da..0decc21186 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2026-04-05 Paul Eggert <[email protected]>
+ term-style-control: use pthread_sigmask
+ * lib/term-style-control.c (block_relevant_signals)
+ (unblock_relevant_signals): Prefer pthread_sigmask to sigprocmask.
+ * modules/term-style-control (Depends-on):
+ Depend on pthread_sigmask, not on sigprocmask.
+
fatal-signal: use pthread_sigmask
* lib/fatal-signal.c (block_fatal_signals)
(unblock_fatal_signals): Prefer pthread_sigmask to sigprocmask.
diff --git a/lib/term-style-control.c b/lib/term-style-control.c
index b2449964a9..efa6d3a44d 100644
--- a/lib/term-style-control.c
+++ b/lib/term-style-control.c
@@ -575,20 +575,14 @@ block_relevant_signals ()
if (!relevant_signal_set_initialized)
abort ();
- /* FIXME: Use pthread_sigmask, not sigprocmask, as the two functions
- behave differently on macOS and the sigprocmask behavior can cause
- this thread to race with other threads in harmful ways. */
- sigprocmask (SIG_BLOCK, &relevant_signal_set, NULL);
+ pthread_sigmask (SIG_BLOCK, &relevant_signal_set, NULL);
}
/* Stop delaying the relevant signals. */
static _GL_ASYNC_SAFE inline void
unblock_relevant_signals ()
{
- /* FIXME: Use pthread_sigmask, not sigprocmask, as the two functions
- behave differently on macOS and the sigprocmask behavior can cause
- this thread to race with other threads in harmful ways. */
- sigprocmask (SIG_UNBLOCK, &relevant_signal_set, NULL);
+ pthread_sigmask (SIG_UNBLOCK, &relevant_signal_set, NULL);
}
#if defined SIGCONT
diff --git a/modules/term-style-control b/modules/term-style-control
index 1266bec4d1..402318aa6d 100644
--- a/modules/term-style-control
+++ b/modules/term-style-control
@@ -9,8 +9,8 @@ m4/tcgetattr.m4
Depends-on:
bool
fatal-signal
+pthread_sigmask
sigaction
-sigprocmask
full-write
fstat
same-inode
--
2.51.0