C signal handling: Difference between revisions

Content deleted Content added
m Reverted 1 edit by 213.55.103.2 (talk) to last revision by Thibaut120094. (TW)
Electrum (talk | contribs)
Update man page link
Line 23:
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 be with <code>signal()</code> or <code>sigaction()</code>. The behavior of <code>signal()</code> has been changed multiple times across history and is now considered deprecated<ref>httpshttp://wwwman7.cs.drexel.eduorg/linux/cgiman-binpages/manServer.plman2/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>.