Asynchronous signals (most of them, including all transmitted by the kill command / function and signals generated by a control terminal of the SIGINT type), are delivered to any process thread in which the signal is unlocked, so you do not need to keep them unlocked in all threads. If you use a dedicated signal processing thread, you want them to be blocked in all threads except the signal processing thread.
Synchronous signals, on the other hand, are delivered to a particular stream as a result of the action of that stream. These include SIGPIPE , SIGBUS , SIGSEGV , SIGFPE , etc. With the exception of SIGPIPE , none of them should happen at all unless you have serious bugs in your program, and you probably want to block SIGPIPE anyway, so that you could get an EPIPE error EPIPE and handle this condition correctly. Therefore, for the most part, I would say that it does not hurt just to block them all. If you really need to handle SIGSEGV or such, you should probably rethink the reasons, but at the same time, feel free to unlock it.
R ..
source share