⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pthread_exit.html

📁 posix标准英文,html格式
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2004 IEEE and The Open Group, All Rights Reserved --><title>pthread_exit</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="pthread_exit"></a> <a name="tag_03_528"></a><!-- pthread_exit --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2004 Edition<br>Copyright &copy; 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_528_01"></a>NAME</h4><blockquote>pthread_exit - thread termination</blockquote><h4><a name="tag_03_528_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('THR')">THR</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> #include &lt;<a href="../basedefs/pthread.h.html">pthread.h</a>&gt;<br><br> void pthread_exit(void *</tt><i>value_ptr</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><tt><br></tt></blockquote><h4><a name="tag_03_528_03"></a>DESCRIPTION</h4><blockquote><p>The <i>pthread_exit</i>() function shall terminate the calling thread and make the value <i>value_ptr</i> available to anysuccessful join with the terminating thread. Any cancellation cleanup handlers that have been pushed and not yet popped shall bepopped in the reverse order that they were pushed and then executed. After all cancellation cleanup handlers have been executed, ifthe thread has any thread-specific data, appropriate destructor functions shall be called in an unspecified order. Threadtermination does not release any application visible process resources, including, but not limited to, mutexes and filedescriptors, nor does it perform any process-level cleanup actions, including, but not limited to, calling any <a href="../functions/atexit.html"><i>atexit</i>()</a> routines that may exist.</p><p>An implicit call to <i>pthread_exit</i>() is made when a thread other than the thread in which <i>main</i>() was first invokedreturns from the start routine that was used to create it. The function's return value shall serve as the thread's exit status.</p><p>The behavior of <i>pthread_exit</i>() is undefined if called from a cancellation cleanup handler or destructor function that wasinvoked as a result of either an implicit or explicit call to <i>pthread_exit</i>().</p><p>After a thread has terminated, the result of access to local (auto) variables of the thread is undefined. Thus, references tolocal variables of the exiting thread should not be used for the <i>pthread_exit</i>() <i>value_ptr</i> parameter value.</p><p>The process shall exit with an exit status of 0 after the last thread has been terminated. The behavior shall be as if theimplementation called <a href="../functions/exit.html"><i>exit</i>()</a> with a zero argument at thread termination time.</p></blockquote><h4><a name="tag_03_528_04"></a>RETURN VALUE</h4><blockquote><p>The <i>pthread_exit</i>() function cannot return to its caller.</p></blockquote><h4><a name="tag_03_528_05"></a>ERRORS</h4><blockquote><p>No errors are defined.</p></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_528_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_528_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_528_08"></a>RATIONALE</h4><blockquote><p>The normal mechanism by which a thread terminates is to return from the routine that was specified in the <a href="../functions/pthread_create.html"><i>pthread_create</i>()</a> call that started it. The <i>pthread_exit</i>() function providesthe capability for a thread to terminate without requiring a return from the start routine of that thread, thereby providing afunction analogous to <a href="../functions/exit.html"><i>exit</i>()</a>.</p><p>Regardless of the method of thread termination, any cancellation cleanup handlers that have been pushed and not yet popped areexecuted, and the destructors for any existing thread-specific data are executed. This volume of IEEE&nbsp;Std&nbsp;1003.1-2001requires that cancellation cleanup handlers be popped and called in order. After all cancellation cleanup handlers have beenexecuted, thread-specific data destructors are called, in an unspecified order, for each item of thread-specific data that existsin the thread. This ordering is necessary because cancellation cleanup handlers may rely on thread-specific data.</p><p>As the meaning of the status is determined by the application (except when the thread has been canceled, in which case it isPTHREAD_CANCELED), the implementation has no idea what an illegal status value is, which is why no address error checking isdone.</p></blockquote><h4><a name="tag_03_528_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_528_10"></a>SEE ALSO</h4><blockquote><p><a href="exit.html"><i>exit</i>()</a>, <a href="pthread_create.html"><i>pthread_create</i>()</a>, <a href="pthread_join.html"><i>pthread_join</i>()</a>, the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/pthread.h.html"><i>&lt;pthread.h&gt;</i></a></p></blockquote><h4><a name="tag_03_528_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 5. Included for alignment with the POSIX Threads Extension.</p></blockquote><h4><a name="tag_03_528_12"></a>Issue 6</h4><blockquote><p>The <i>pthread_exit</i>() function is marked as part of the Threads option.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -