1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
<table class="head">
<tr>
<td class="head-ltitle">PTHREAD_EXIT(3)</td>
<td class="head-vol">Library Functions Manual</td>
<td class="head-rtitle">PTHREAD_EXIT(3)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">pthread_exit</code> —
<span class="Nd">terminate the calling thread</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1>
<p class="Pp"><span class="Lb">POSIX Threads Library (libpthread,
-lpthread)</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
<<a class="In">pthread.h</a>></code></p>
<p class="Pp"><var class="Ft">void</var>
<br/>
<code class="Fn">pthread_exit</code>(<var class="Fa" style="white-space: nowrap;">void
*value_ptr</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The
<a class="permalink" href="#pthread_exit"><code class="Fn" id="pthread_exit">pthread_exit</code></a>()
function terminates the calling thread and makes the value
<var class="Fa">value_ptr</var> available to any successful join with the
terminating thread. Any cancellation cleanup handlers that have been pushed
and are not yet popped are popped in the reverse order that they were pushed
and then executed. After all cancellation handlers have been executed, if
the thread has any thread-specific data, appropriate destructor functions
are called in an unspecified order. Thread termination does not release any
application visible process resources, including, but not limited to,
mutexes and file descriptors, nor does it perform any process level cleanup
actions, including, but not limited to, calling
<a class="permalink" href="#atexit"><code class="Fn" id="atexit">atexit</code></a>()
routines that may exist.</p>
<p class="Pp" id="pthread_exit~2">An implicit call to
<a class="permalink" href="#pthread_exit~2"><code class="Fn">pthread_exit</code></a>()
is made when a thread other than the thread in which
<a class="permalink" href="#main"><code class="Fn" id="main">main</code></a>()
was first invoked returns from the start routine that was used to create it.
The function's return value serves as the thread's exit status.</p>
<p class="Pp" id="pthread_exit~3">The behavior of
<a class="permalink" href="#pthread_exit~3"><code class="Fn">pthread_exit</code></a>()
is undefined if called from a cancellation handler or destructor function
that was invoked as the result of an implicit or explicit call to
<code class="Fn">pthread_exit</code>().</p>
<p class="Pp" id="pthread_exit~4">After a thread has terminated, the result of
access to local (auto) variables of the thread is undefined. Thus,
references to local variables of the exiting thread should not be used for
the
<a class="permalink" href="#pthread_exit~4"><code class="Fn">pthread_exit</code></a>()
<var class="Fa">value_ptr</var> parameter value.</p>
<p class="Pp" id="exit">The process will exit with an exit status of 0 after the
last thread has been terminated. The behavior is as if the implementation
called <a class="permalink" href="#exit"><code class="Fn">exit</code></a>()
with a zero argument at thread termination time.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
VALUES</a></h1>
<p class="Pp">The <code class="Fn">pthread_exit</code>() function cannot return
to its caller.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
<p class="Pp">None.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">_exit(2)</a>, <a class="Xr">exit(3)</a>,
<a class="Xr">pthread_cancel(3)</a>, <a class="Xr">pthread_create(3)</a>,
<a class="Xr">pthread_join(3)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="STANDARDS"><a class="permalink" href="#STANDARDS">STANDARDS</a></h1>
<p class="Pp">The <code class="Fn">pthread_exit</code>() function conforms to
<span class="St">ISO/IEC 9945-1:1996 (“POSIX.1”)</span>.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">March 15, 2014</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|