summaryrefslogtreecommitdiff
path: root/devdocs/c/thread%2Fthrd_exit.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/c/thread%2Fthrd_exit.html
new repository
Diffstat (limited to 'devdocs/c/thread%2Fthrd_exit.html')
-rw-r--r--devdocs/c/thread%2Fthrd_exit.html25
1 files changed, 25 insertions, 0 deletions
diff --git a/devdocs/c/thread%2Fthrd_exit.html b/devdocs/c/thread%2Fthrd_exit.html
new file mode 100644
index 00000000..03680641
--- /dev/null
+++ b/devdocs/c/thread%2Fthrd_exit.html
@@ -0,0 +1,25 @@
+ <h1 id="firstHeading" class="firstHeading">thrd_exit</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code>&lt;threads.h&gt;</code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c11 t-until-c23"> <td><pre data-language="c">_Noreturn void thrd_exit( int res );</pre></td> <td class="t-dcl-nopad"> </td> <td>
+<span class="t-mark-rev t-since-c11">(since C11)</span> <br><span class="t-mark-rev t-until-c23">(until C23)</span>
+</td> </tr> <tr class="t-dcl t-since-c23"> <td> <pre data-language="c">[[noreturn]] void thrd_exit( int res );</pre>
+</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c23">(since C23)</span> </td> </tr> </table> <p>First, for every thread-specific storage key which was created with a non-null destructor and for which the associated value is non-null (see <code><a href="tss_create" title="c/thread/tss create">tss_create</a></code>), <code>thrd_exit</code> sets the value associated with the key to <code><a href="http://en.cppreference.com/w/c/types/NULL"><span class="kw103">NULL</span></a></code> and then invokes the destructor with the previous value of the key. The order in which the destructors are invoked is unspecified.</p>
+<p>If, after this, there remain keys with both non-null destructors and values (e.g. if a destructor executed <code><a href="tss_set" title="c/thread/tss set">tss_set</a></code>), the process is repeated up to <code><a href="tss_dtor_iterations" title="c/thread/TSS DTOR ITERATIONS">TSS_DTOR_ITERATIONS</a></code> times.</p>
+<p>Finally, the <code>thrd_exit</code> function terminates execution of the calling thread and sets its result code to <code>res</code>.</p>
+<p>If the last thread in the program is terminated with <code>thrd_exit</code>, the entire program terminates as if by calling <code><a href="../program/exit" title="c/program/exit">exit</a></code> with <code><a href="../program/exit_status" title="c/program/EXIT status">EXIT_SUCCESS</a></code> as the argument (so the functions registered by <code><a href="../program/atexit" title="c/program/atexit">atexit</a></code> are executed in the context of that last thread)</p>
+<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> res </td> <td> - </td> <td> the result value to return </td>
+</tr>
+</table> <h3 id="Return_value"> Return value</h3> <p>(none)</p>
+<h3 id="References"> References</h3> <ul>
+<li> C17 standard (ISO/IEC 9899:2018): </li>
+<ul><li> 7.26.5.5 The thrd_exit function (p: 280) </li></ul>
+<li> C11 standard (ISO/IEC 9899:2011): </li>
+<ul><li> 7.26.5.5 The thrd_exit function (p: 384) </li></ul>
+</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="thrd_join" title="c/thread/thrd join"> <span class="t-lines"><span>thrd_join</span></span></a></div>
+<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> blocks until a thread terminates <br> <span class="t-mark">(function)</span> </td>
+</tr> <tr class="t-dsc"> <td> <div><a href="thrd_detach" title="c/thread/thrd detach"> <span class="t-lines"><span>thrd_detach</span></span></a></div>
+<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> detaches a thread <br> <span class="t-mark">(function)</span> </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/thread/thrd_exit" class="_attribution-link">https://en.cppreference.com/w/c/thread/thrd_exit</a>
+ </p>
+</div>