1pthread_exit(3C)         Standard C Library Functions         pthread_exit(3C)
2
3
4

NAME

6       pthread_exit - terminate calling thread
7

SYNOPSIS

9       cc -mt [ flag... ] file... -lpthread [ library... ]
10       #include <pthread.h>
11
12       void pthread_exit(void *value_ptr);
13
14

DESCRIPTION

16       The pthread_exit() function terminates the calling thread, in a similar
17       way that exit(3C) terminates the calling process. If the thread is  not
18       detached, the exit status specified by  value_ptr is made  available to
19       any successful join with the terminating thread. See  pthread_join(3C).
20       Any  cancellation  cleanup  handlers  that have been pushed and not yet
21       popped are popped in the reverse order that they were pushed  and  then
22       executed.  After  all cancellation cleanup handlers have been executed,
23       if the thread has  any  thread-specific  data,  appropriate  destructor
24       functions  will  be  called in an unspecified order. Thread termination
25       does not release any application visible process resources,  including,
26       but  not  limited to, mutexes and file descriptors, nor does it perform
27       any process level cleanup actions, including, but not limited to, call‐
28       ing any atexit() routines that might exist.
29
30
31       An exiting thread runs with all signals blocked. All thread termination
32       functions, including cancellation cleanup handlers and  thread-specific
33       data destructor functions, are called with all signals blocked.
34
35
36       An implicit call to pthread_exit() is made when a thread other than the
37       thread in which main() was first invoked returns from the start routine
38       that  was  used to create it. The function's return value serves as the
39       thread's exit status.
40
41
42       The behavior of pthread_exit() is undefined if called from a  cancella‐
43       tion  cleanup  handler  or  destructor  function  that was invoked as a
44       result of either an implicit or explicit call to pthread_exit().
45
46
47       After a thread has terminated, the result of  access  to  local  (auto)
48       variables  of  the thread is undefined. Thus, references to local vari‐
49       ables of the exiting thread should not be used for  the  pthread_exit()
50       value_ptr parameter value.
51
52
53       The  process  exits with an exit status of  0 after the last thread has
54       been terminated. The behavior is as if the implementation called exit()
55       with a 0 argument at thread termination time.
56

RETURN VALUES

58       The pthread_exit() function cannot return to its caller.
59

ERRORS

61       No errors are defined.
62

ATTRIBUTES

64       See attributes(5) for descriptions of the following attributes:
65
66
67
68
69       ┌─────────────────────────────┬─────────────────────────────┐
70       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
71       ├─────────────────────────────┼─────────────────────────────┤
72       │Interface Stability          │Committed                    │
73       ├─────────────────────────────┼─────────────────────────────┤
74       │MT-Level                     │MT-Safe                      │
75       ├─────────────────────────────┼─────────────────────────────┤
76       │Standard                     │See standards(5).            │
77       └─────────────────────────────┴─────────────────────────────┘
78

SEE ALSO

80       exit(3C),   pthread_cancel(3C),  pthread_create(3C),  pthread_join(3C),
81       pthread_key_create(3C), attributes(5), standards(5)
82
83
84
85SunOS 5.11                        2 Nov 2007                  pthread_exit(3C)
Impressum