The following program demonstrates how each thread in a process has its own signal mask (which is inherited from the thread's creator). A common approach to using signals with threads is to block (mask) the signals in all threads (using the library function pthread_sigmask), and designate one thread that handles the signals synchronously using the library function sigwait.
Additional files: