1 .\" Copyright (c) 2004-2007 Apple Inc. All rights reserved.
6 .Nm pthread_attr_getdetachstate ,
7 .Nm pthread_attr_setdetachstate
8 .Nd thread attribute operations
10 .Fd #include <pthread.h>
12 .Fo pthread_attr_getdetachstate
13 .Fa "const pthread_attr_t *attr"
14 .Fa "int *detachstate"
17 .Fo pthread_attr_setdetachstate
18 .Fa "pthread_attr_t *attr"
22 Thread attributes are used to specify parameters to
24 One attribute object can be used in multiple calls to
26 with or without modifications between calls.
28 One of these thread attributes governs the creation state of the new thread. The new thread
29 can be either created "detached" or "joinable". The constants corresponding to these states are PTHREAD_CREATE_DETACHED and PTHREAD_CREATE_JOINABLE respectively.
30 Creating a "joinable" thread allows the user
35 with the new thread's ID. A "detached" thread's ID cannot be used with
39 The default value for the "detachstate" attribute is PTHREAD_CREATE_JOINABLE.
42 .Fn pthread_attr_setdetachstate
43 function sets the thread's "detachstate" attribute.
45 The "detachstate" attribute is set within the
47 argument, which can subsequently be used as an argument to
50 If successful, these functions return 0.
51 Otherwise, an error number is returned to indicate the error.
52 .Fn pthread_attr_getdetachstate ,
53 on success, will copy the value of the thread's "detachstate" attribute
54 to the location pointed to by the second function parameter.
56 .Fn pthread_attr_getdetachstate
65 .Fn pthread_attr_setdetachstate
77 .Xr pthread_create 3 ,
79 .Xr pthread_attr_init 3 ,
82 .Fn pthread_attr_setdetachstate ,
83 .Fn pthread_attr_getdetachstate