Paul Eggert wrote: > For years, POSIX has recommended that multithreaded apps use > pthread_sigmask instead of sigprocmask.
The two tests are easy as well. No need to worry about the link requirements, since these tests are already linked with $(LIBMULTITHREAD). 2026-04-04 Bruno Haible <[email protected]> linked-list-unportable-tests: Prefer pthread_sigmask over sigprocmask. Suggested by Paul Eggert. * tests/test-asyncsafe-linked_list-strong.c (block_sigint): Use pthread_sigmask instead of sigprocmask. * tests/test-asyncsafe-linked_list-weak.c (block_sigint): Likewise. diff --git a/tests/test-asyncsafe-linked_list-strong.c b/tests/test-asyncsafe-linked_list-strong.c index 253c4c4cac..fcf9a7a043 100644 --- a/tests/test-asyncsafe-linked_list-strong.c +++ b/tests/test-asyncsafe-linked_list-strong.c @@ -124,10 +124,7 @@ block_sigint (void) sigemptyset (&mask); sigaddset (&mask, MY_SIGNAL); - /* 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, &mask, NULL); + pthread_sigmask (SIG_BLOCK, &mask, NULL); } /* This thread is idle. */ diff --git a/tests/test-asyncsafe-linked_list-weak.c b/tests/test-asyncsafe-linked_list-weak.c index fc1f3b35b2..27e6a3e700 100644 --- a/tests/test-asyncsafe-linked_list-weak.c +++ b/tests/test-asyncsafe-linked_list-weak.c @@ -241,10 +241,7 @@ block_sigint (void) sigemptyset (&mask); sigaddset (&mask, MY_SIGNAL); - /* 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, &mask, NULL); + pthread_sigmask (SIG_BLOCK, &mask, NULL); } /* This thread is idle. */
