From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/program%2Fsig_strategies.html | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 devdocs/c/program%2Fsig_strategies.html (limited to 'devdocs/c/program%2Fsig_strategies.html') diff --git a/devdocs/c/program%2Fsig_strategies.html b/devdocs/c/program%2Fsig_strategies.html new file mode 100644 index 00000000..f4a8f245 --- /dev/null +++ b/devdocs/c/program%2Fsig_strategies.html @@ -0,0 +1,41 @@ +

SIG_DFL, SIG_IGN

Defined in header <signal.h>
#define SIG_DFL /*implementation defined*/
+
#define SIG_IGN /*implementation defined*/
+

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

#include <signal.h>
+#include <stdio.h>
+ 
+int main(void)
+{
+    /* using the default signal handler */
+    raise(SIGTERM);
+    printf("Exit main()\n");   /* never reached */
+}

Output:

+
(none)

Example

#include <signal.h>
+#include <stdio.h>
+ 
+int main(void)
+{
+    /* ignoring the signal */
+    signal(SIGTERM, SIG_IGN);
+    raise(SIGTERM);
+    printf("Exit main()\n");
+}

Output:

+
Exit main()

References

See also

+
C++ documentation for SIG_DFL, SIG_IGN
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/program/SIG_strategies +

+
-- cgit v1.2.3