wayland: block SIGUSR2 early so library threads inherit the mask

SIGUSR2 was being delivered to pango fontconfig threads instead of the
signalfd because those threads were created before the signal mask was
set in wl_event_loop_run. Block SIGUSR2 at the very start of real_main
so all threads (including library-spawned ones) inherit the blocked
mask and the signalfd is the sole recipient.
This commit is contained in:
Window Maker 2026-05-25 12:00:13 +02:00
parent 8630a5ce95
commit d8592f3b57
1 changed files with 12 additions and 0 deletions

View File

@ -32,6 +32,8 @@
#include <sys/types.h>
#include <fcntl.h>
#include <locale.h>
#include <signal.h>
#include <pthread.h>
/* Xlocale.h and locale.h are the same if X_LOCALE is undefind in wconfig.h,
@ -617,6 +619,16 @@ static int real_main(int argc, char **argv)
{
int i;
/* Block SIGUSR2 early so all threads (including library threads like
* pango's fontconfig thread) inherit the blocked mask. The signalfd
* in the Wayland event loop will be the sole recipient. */
{
sigset_t ss;
sigemptyset(&ss);
sigaddset(&ss, SIGUSR2);
pthread_sigmask(SIG_BLOCK, &ss, NULL);
}
setlocale(LC_ALL, "");
wsetabort(wAbort);