Content deleted Content added
LiberatorG (talk | contribs) Reverted 2 edits by 103.40.80.11 (talk): Printf does not output a newline and while loop prevents execution of the following lines. (TW) |
zi |
||
Line 21:
A signal can be generated by calling <code>raise()</code> or <code>kill()</code> system calls. <code>raise()</code> sends a signal to the current process, <code>kill()</code> sends a signal to a specific process.
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. 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>.
|