2 * Create a thread that is running [the sleeper] with a signal blocked
3 * and use the other thread to block on select. This is so that we can
4 * send the signal on the "select" thread. Interrupt the selected thread
5 * with alarm. Detects bug in libpthread where we did not use the proper
6 * signal mask, so only the first signal got delivered.
15 static sig_atomic_t count
= 0;
27 for (i
= 0; i
< 10; i
++)
33 main(int argc
, char** argv
)
38 act
.sa_sigaction
= NULL
;
39 sigemptyset(&act
.sa_mask
);
41 act
.sa_handler
= handler
;
43 if (sigaction(SIGALRM
, &act
, NULL
) == -1)
46 sigaddset(&act
.sa_mask
, SIGALRM
);
47 pthread_sigmask(SIG_SETMASK
, &act
.sa_mask
, NULL
);
49 pthread_create(&id
, NULL
, sleeper
, NULL
);
52 sigemptyset(&act
.sa_mask
);
53 pthread_sigmask(SIG_SETMASK
, &act
.sa_mask
, NULL
);
57 if (select(1, NULL
, NULL
, NULL
, NULL
) == -1 && errno
== EINTR
)