5
Last change
on this file since 04da96c7 was
c499856,
checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47
|
Change all references of rtems.com to rtems.org.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Detaching a Thread |
---|
5 | * @ingroup POSIXAPI |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2014. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <pthread.h> |
---|
22 | #include <errno.h> |
---|
23 | |
---|
24 | #include <rtems/posix/pthreadimpl.h> |
---|
25 | #include <rtems/score/threadimpl.h> |
---|
26 | |
---|
27 | /** |
---|
28 | * 16.1.4 Detaching a Thread, P1003.1c/Draft 10, p. 149 |
---|
29 | */ |
---|
30 | int pthread_detach( |
---|
31 | pthread_t thread |
---|
32 | ) |
---|
33 | { |
---|
34 | Thread_Control *the_thread; |
---|
35 | POSIX_API_Control *api; |
---|
36 | Objects_Locations location; |
---|
37 | |
---|
38 | the_thread = _Thread_Get( thread, &location ); |
---|
39 | switch ( location ) { |
---|
40 | |
---|
41 | case OBJECTS_LOCAL: |
---|
42 | |
---|
43 | api = the_thread->API_Extensions[ THREAD_API_POSIX ]; |
---|
44 | api->detachstate = PTHREAD_CREATE_DETACHED; |
---|
45 | api->Attributes.detachstate = PTHREAD_CREATE_DETACHED; |
---|
46 | _Objects_Put( &the_thread->Object ); |
---|
47 | return 0; |
---|
48 | |
---|
49 | #if defined(RTEMS_MULTIPROCESSING) |
---|
50 | case OBJECTS_REMOTE: |
---|
51 | #endif |
---|
52 | case OBJECTS_ERROR: |
---|
53 | break; |
---|
54 | } |
---|
55 | |
---|
56 | return ESRCH; |
---|
57 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.