2 ms·
You don't have to be prepared to handle signals most of the time. When a signal arrives, execution gets interrupted, the signal is handled, then execution resum
by mikeash 11y ago
You don't have to be prepared to handle signals most of the time. When a signal arrives, execution gets interrupted, the signal is handled, then execution resumes transparently. The code doesn't even know anything happened. This is vastly different from throwing an exception in the middle of arbitrary, unexpecting code.
Failing to handle EINTR is not good, but at least it fails cleanly. This is still way, way better than throwing an exception in random places, potentially in code that "can't throw," and leaving a trail of corruption behind.