Defined in header <signal.h> | ||||
---|---|---|---|---|
| ||||
|
The SIG_DFL
and SIG_IGN
macros expand into integral expressions that are not equal to an address of any function. The macros define signal handling strategies for signal()
function.
Constant | Explanation |
---|---|
SIG_DFL | default signal handling |
SIG_IGN | signal is ignored |
Example
1 2 3 4 5 6 7 8 9 | #include <signal.h> #include <stdio.h> int main( void ) { /* using the default signal handler */ raise (SIGTERM); printf ( "Exit main()\n" ); /* never reached */ } |
Output:
1 | (none) |
Example
1 2 3 4 5 6 7 8 9 10 | #include <signal.h> #include <stdio.h> int main( void ) { /* ignoring the signal */ signal (SIGTERM, SIG_IGN); raise (SIGTERM); printf ( "Exit main()\n" ); } |
Output:
1 | Exit main() |
References
- C11 standard (ISO/IEC 9899:2011):
- 7.14/3 Signal handling <signal.h> (p: 265)
- C99 standard (ISO/IEC 9899:1999):
- 7.14/3 Signal handling <signal.h> (p: 246)
- C89/C90 standard (ISO/IEC 9899:1990):
- 4.7 SIGNAL HANDLING <signal.h>
See also
C++ documentation for SIG_DFL, SIG_IGN |
Please login to continue.