tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Question on signal delivery in threaded applications


Imagine the following scenario:

A process spawns a bunch of threads all of which are suspended via
siguspend(). The threads are ignoring all signals, except for say
SIGUSR1. Piece and quiet. At some point a signal arrives at the
_process_ level (e.g., via kill). What happens ?

1. Some random thread is awaken and the SIGUSR1 signal is delivered to
it. sigsuspend() returns -1 and sets errno to EINTR for this
particular thread. The rest of the threads keep sleeping
2. All threads awake and race against each other on which one shall
consume the SIGUSR1.
3. Something else.

I've skimmed through the POSIX specs, but couldn't get a straight answer.
I'd really appreciate any insights/pointers.

Best regards,

Home | Main Index | Thread Index | Old Index