Content deleted Content added
Jason Quinn (talk | contribs) →Handling: it's not "deprecated"! that's a term with an official technical meaning. |
Jason Quinn (talk | contribs) →Handling: grammar fix |
||
Line 28:
A signal handler is a [[Function (computer science)|function]] which is called by the target environment when the corresponding signal occurs. The target environment suspends execution of the program until the signal handler returns or calls <code>longjmp()</code>.
Signal handlers can be set with <code>signal()</code> or <code>sigaction()</code>. The behavior of <code>signal()</code> has been changed multiple times across history and its use is discouraged.<ref>https://man7.org/linux/man-pages/man2/signal.2.html Signal(2) manpage</ref> It is only portable when used to set a signal's disposition to SIG_DFL or SIG_IGN. Signal handlers can be specified for all but two signals ([[SIGKILL]] and [[SIGSTOP]] cannot be caught, blocked or ignored).
If the signal reports an error within the program (and the signal is not asynchronous), the signal handler can terminate by calling <code>abort()</code>, <code>exit()</code>, or <code>longjmp()</code>.
|