Paul Eggert wrote: > In this patch I did not add a FIXME for sigpipe-die; instead, I added a > comment saying that install_sigpipe_die_handler should be called only in > a single-threaded process
Actually, the restriction can be relaxed: It is OK to call install_sigpipe_die_handler in a multithreaded program, at a moment when the main thread is still the only thread. That's because future threads will inherite the signal mask from the main thread [1]. [1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/pthread_create.html 2026-04-04 Bruno Haible <[email protected]> sigpipe-die: Relax specification. * lib/sigpipe-die.h (install_sigpipe_die_handler): Clarify how to use this function in a multithreaded program. diff --git a/lib/sigpipe-die.h b/lib/sigpipe-die.h index 6cf56c6ec3..76c871d7be 100644 --- a/lib/sigpipe-die.h +++ b/lib/sigpipe-die.h @@ -57,7 +57,8 @@ extern "C" { /* Install a SIGPIPE handler that invokes PREPARE_DIE and then emits an error message and exits. PREPARE_DIE may be NULL, meaning a no-op. - This function should not be called in a multithreaded process. */ + In a multithreaded program, this function must be called in the main thread, + before any other thread gets created. */ extern void install_sigpipe_die_handler (void (*prepare_die) (void));
