4.115
Last change
on this file since 2d2352b was
2d2352b,
checked in by Sebastian Huber <sebastian.huber@…>, on 06/05/13 at 09:48:57
|
score: Add and use _Objects_Put()
Add and use _Objects_Put_without_thread_dispatch(). These two functions
pair with the _Objects_Get() function. This helps to introduce object
specific SMP locks to avoid lock contention.
|
-
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-2007. |
---|
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.com/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/system.h> |
---|
25 | #include <rtems/score/thread.h> |
---|
26 | #include <rtems/posix/pthread.h> |
---|
27 | |
---|
28 | /** |
---|
29 | * 16.1.4 Detaching a Thread, P1003.1c/Draft 10, p. 149 |
---|
30 | */ |
---|
31 | int pthread_detach( |
---|
32 | pthread_t thread |
---|
33 | ) |
---|
34 | { |
---|
35 | register Thread_Control *the_thread; |
---|
36 | POSIX_API_Control *api; |
---|
37 | Objects_Locations location; |
---|
38 | |
---|
39 | the_thread = _Thread_Get( thread, &location ); |
---|
40 | switch ( location ) { |
---|
41 | |
---|
42 | case OBJECTS_LOCAL: |
---|
43 | |
---|
44 | api = the_thread->API_Extensions[ THREAD_API_POSIX ]; |
---|
45 | api->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.