The good news is that the POSIX committee has come up with a recommendation to the developers of MT applications for signal-handling. This solution rests on an interesting design fact; although a process has a table of signal dispositions (set up by the kernel and the sigaction(2) system call), every thread within the process has its own discrete signal mask (using which it can selectively block signals) and signal pending mask (by which the kernel remembers which signals are pending delivery to the thread).
Knowing this, the POSIX standard recommends that a developer handle signals in a pthreads application as follows:
- Mask (block) all signals in the main thread.
- Now any thread created by main ...