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.3 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Set Specific Key |
---|
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 <errno.h> |
---|
22 | #include <limits.h> |
---|
23 | #include <pthread.h> |
---|
24 | #include <string.h> |
---|
25 | |
---|
26 | #include <rtems/system.h> |
---|
27 | #include <rtems/score/thread.h> |
---|
28 | #include <rtems/score/wkspace.h> |
---|
29 | #include <rtems/posix/key.h> |
---|
30 | |
---|
31 | /* |
---|
32 | * 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165 |
---|
33 | */ |
---|
34 | |
---|
35 | int pthread_setspecific( |
---|
36 | pthread_key_t key, |
---|
37 | const void *value |
---|
38 | ) |
---|
39 | { |
---|
40 | register POSIX_Keys_Control *the_key; |
---|
41 | uint32_t api; |
---|
42 | uint32_t index; |
---|
43 | Objects_Locations location; |
---|
44 | |
---|
45 | the_key = _POSIX_Keys_Get( key, &location ); |
---|
46 | switch ( location ) { |
---|
47 | |
---|
48 | case OBJECTS_LOCAL: |
---|
49 | api = _Objects_Get_API( _Thread_Executing->Object.id ); |
---|
50 | index = _Objects_Get_index( _Thread_Executing->Object.id ); |
---|
51 | the_key->Values[ api ][ index ] = (void *) value; |
---|
52 | _Objects_Put( &the_key->Object ); |
---|
53 | return 0; |
---|
54 | |
---|
55 | #if defined(RTEMS_MULTIPROCESSING) |
---|
56 | case OBJECTS_REMOTE: /* should never happen */ |
---|
57 | #endif |
---|
58 | case OBJECTS_ERROR: |
---|
59 | break; |
---|
60 | } |
---|
61 | |
---|
62 | return EINVAL; |
---|
63 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.