summaryrefslogtreecommitdiff
path: root/devdocs/c/program%2Fsig_strategies.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/c/program%2Fsig_strategies.html')
-rw-r--r--devdocs/c/program%2Fsig_strategies.html41
1 files changed, 41 insertions, 0 deletions
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 @@
+ <h1 id="firstHeading" class="firstHeading">SIG_DFL, SIG_IGN</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code>&lt;signal.h&gt;</code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl"> <td class="t-dcl-nopad"> <pre data-language="c">#define SIG_DFL /*implementation defined*/</pre>
+</td> <td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl"> <td class="t-dcl-nopad"> <pre data-language="c">#define SIG_IGN /*implementation defined*/</pre>
+</td> <td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> </table> <p>The <code>SIG_DFL</code> and <code>SIG_IGN</code> macros expand into integral expressions that are not equal to an address of any function. The macros define signal handling strategies for <code><a href="http://en.cppreference.com/w/c/program/signal"><span class="kw497">signal</span></a><span class="br0">(</span><span class="br0">)</span></code> function.</p>
+<table class="t-dsc-begin"> <tr class="t-dsc-hitem"> <th> Constant </th> <th> Explanation </th>
+</tr> <tr class="t-dsc"> <td> <code>SIG_DFL</code> </td> <td> default signal handling </td>
+</tr> <tr class="t-dsc"> <td> <code>SIG_IGN</code> </td> <td> signal is ignored </td>
+</tr> </table> <h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include &lt;signal.h&gt;
+#include &lt;stdio.h&gt;
+
+int main(void)
+{
+ /* using the default signal handler */
+ raise(SIGTERM);
+ printf("Exit main()\n"); /* never reached */
+}</pre></div> <p>Output:</p>
+<div class="text source-text"><pre data-language="c">(none)</pre></div> </div> <h3 id="Example_2"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include &lt;signal.h&gt;
+#include &lt;stdio.h&gt;
+
+int main(void)
+{
+ /* ignoring the signal */
+ signal(SIGTERM, SIG_IGN);
+ raise(SIGTERM);
+ printf("Exit main()\n");
+}</pre></div> <p>Output:</p>
+<div class="text source-text"><pre data-language="c">Exit main()</pre></div> </div> <h3 id="References"> References</h3> <ul>
+<li> C17 standard (ISO/IEC 9899:2018): </li>
+<ul><li> 7.14/3 Signal handling &lt;signal.h&gt; (p: 193) </li></ul>
+<li> C11 standard (ISO/IEC 9899:2011): </li>
+<ul><li> 7.14/3 Signal handling &lt;signal.h&gt; (p: 265) </li></ul>
+<li> C99 standard (ISO/IEC 9899:1999): </li>
+<ul><li> 7.14/3 Signal handling &lt;signal.h&gt; (p: 246) </li></ul>
+<li> C89/C90 standard (ISO/IEC 9899:1990): </li>
+<ul><li> 4.7 SIGNAL HANDLING &lt;signal.h&gt; </li></ul>
+</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/utility/program/SIG_strategies" title="cpp/utility/program/SIG strategies">C++ documentation</a></span> for <code>SIG_DFL, SIG_IGN</code> </td>
+</tr> </table> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
+ <a href="https://en.cppreference.com/w/c/program/SIG_strategies" class="_attribution-link">https://en.cppreference.com/w/c/program/SIG_strategies</a>
+ </p>
+</div>