Signals directed at a thread are delivered to the specified thread.
Signals directed at a process are delivered to a thread which is selected
based on the following algorithm:
If the action for this signal is currently SIG_IGN,
then the signal is simply ignored.
If the currently executing thread has the signal unblocked, then
the signal is delivered to it.
If any threads are currently blocked waiting for this signal
(sigwait()), then the signal is delivered to the highest priority
thread waiting for this signal.
If any other threads are willing to accept delivery of the signal, then
the signal is delivered to the highest priority thread of this set. In the
event, multiple threads of the same priority are willing to accept this
signal, then priority is given first to ready threads, then to threads
blocked on calls which may be interrupted, and finally to threads blocked
on non-interruptible calls.
In the event the signal still can not be delivered, then it is left
pending. The first thread to unblock the signal (sigprocmask() or
pthread_sigprocmask()) or to wait for this signal
(sigwait()) will be the recipient of the signal.