3 ms·
Signals play nice with threads. It's sloppy thread programming that doesn't play nice with signals.
by beat 7y ago
Signals play nice with threads.
It's sloppy thread programming that doesn't play nice with signals.
- rocqua 7y agoConsider the following scenario: Two threads both want to MMAP a file / catch SIGSEGV for different pieces of code. Moreover, these threads come from different modules of a system maintained by different people. All of a sudden, these modules become coupled because we need some system for delegation of signal handlers between them. Or, we need to introduce a custom signal-handler module to deal with our delegation. I would not call that 'playing nice with threads' nor would I call that sloppy thread programming.
- hyc_symas 7y agoYou're really just talking about poor practice in writing signal handlers. The signal API always tells you the previous value of a handler. Your own handlers should remember the previous value and call it if your own handler doesn't fully handle a signal it receives.