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

NAME

6       pthread_detach - detach a thread
7

SYNOPSIS

9       cc -mt [ flag... ] file... -lpthread [ library... ]
10       #include <pthread.h>
11
12       int pthread_detach(pthread_t thread);
13
14

DESCRIPTION

16       The pthread_detach() function is used to indicate to the implementation
17       that storage for the thread thread can be reclaimed  when  that  thread
18       terminates.  In  other  words,  pthread_detach() dynamically resets the
19       detachstate attribute of the thread to PTHREAD_CREATE_DETACHED. After a
20       successful  call to this function, it would not be necessary to reclaim
21       the thread using  pthread_join(). See pthread_join(3C). If  thread  has
22       not  terminated,  pthread_detach()  will not cause it to terminate. The
23       effect of multiple pthread_detach() calls on the same target thread  is
24       unspecified.
25

RETURN VALUES

27       If  successful, pthread_detach() returns  0. Otherwise, an error number
28       is returned to indicate the error.
29

ERRORS

31       The  pthread_detach() function will fail if:
32
33       EINVAL    The implementation has detected that the value  specified  by
34                 thread does not refer to a joinable thread.
35
36
37       ESRCH     No  thread  could be found corresponding to that specified by
38                 the given thread  ID.
39
40

ATTRIBUTES

42       See attributes(5) for descriptions of the following attributes:
43
44
45
46
47       ┌─────────────────────────────┬─────────────────────────────┐
48       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
49       ├─────────────────────────────┼─────────────────────────────┤
50       │Interface Stability          │Standard                     │
51       ├─────────────────────────────┼─────────────────────────────┤
52       │MT-Level                     │MT-Safe                      │
53       └─────────────────────────────┴─────────────────────────────┘
54

SEE ALSO

56       pthread_create(3C), pthread_join(3C), attributes(5), standards(5)
57
58
59
60SunOS 5.11                        23 Mar 2005               pthread_detach(3C)
Impressum