4.115
Last change
on this file since 23fec9f0 was
23fec9f0,
checked in by Sebastian Huber <sebastian.huber@…>, on 03/27/14 at 13:16:12
|
score: PR2152: Use allocator mutex for objects
Use allocator mutex for objects allocate/free. This prevents that the
thread dispatch latency depends on the workspace/heap fragmentation.
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Deletes Thread-specific Data Key Previously Returned by keycreate.c |
---|
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.org/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/keyimpl.h> |
---|
30 | |
---|
31 | /* |
---|
32 | * 17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167 |
---|
33 | */ |
---|
34 | int pthread_key_delete( |
---|
35 | pthread_key_t key |
---|
36 | ) |
---|
37 | { |
---|
38 | POSIX_Keys_Control *the_key; |
---|
39 | Objects_Locations location; |
---|
40 | |
---|
41 | _Objects_Allocator_lock(); |
---|
42 | the_key = _POSIX_Keys_Get( key, &location ); |
---|
43 | switch ( location ) { |
---|
44 | |
---|
45 | case OBJECTS_LOCAL: |
---|
46 | _POSIX_Keys_Free_memory( the_key ); |
---|
47 | |
---|
48 | /* |
---|
49 | * NOTE: The destructor is not called and it is the responsibility |
---|
50 | * of the application to free the memory. |
---|
51 | */ |
---|
52 | _POSIX_Keys_Free( the_key ); |
---|
53 | _Objects_Put(&the_key->Object); |
---|
54 | _Objects_Allocator_unlock(); |
---|
55 | return 0; |
---|
56 | |
---|
57 | #if defined(RTEMS_MULTIPROCESSING) |
---|
58 | case OBJECTS_REMOTE: /* should never happen */ |
---|
59 | #endif |
---|
60 | case OBJECTS_ERROR: |
---|
61 | break; |
---|
62 | } |
---|
63 | |
---|
64 | _Objects_Allocator_unlock(); |
---|
65 | |
---|
66 | return EINVAL; |
---|
67 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.