4.104.114.84.95
Line | |
---|
1 | /* |
---|
2 | * $Id$ |
---|
3 | */ |
---|
4 | |
---|
5 | #include <errno.h> |
---|
6 | #include <limits.h> |
---|
7 | #include <pthread.h> |
---|
8 | #include <string.h> |
---|
9 | |
---|
10 | #include <rtems/system.h> |
---|
11 | #include <rtems/score/thread.h> |
---|
12 | #include <rtems/score/wkspace.h> |
---|
13 | #include <rtems/posix/key.h> |
---|
14 | |
---|
15 | /*PAGE |
---|
16 | * |
---|
17 | * 17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167 |
---|
18 | */ |
---|
19 | |
---|
20 | int pthread_key_delete( |
---|
21 | pthread_key_t key |
---|
22 | ) |
---|
23 | { |
---|
24 | register POSIX_Keys_Control *the_key; |
---|
25 | Objects_Locations location; |
---|
26 | unsigned32 the_class; |
---|
27 | |
---|
28 | the_key = _POSIX_Keys_Get( key, &location ); |
---|
29 | switch ( location ) { |
---|
30 | case OBJECTS_ERROR: |
---|
31 | case OBJECTS_REMOTE: /* should never happen */ |
---|
32 | return EINVAL; |
---|
33 | case OBJECTS_LOCAL: |
---|
34 | _Objects_Close( &_POSIX_Keys_Information, &the_key->Object ); |
---|
35 | |
---|
36 | the_key->is_active = FALSE; |
---|
37 | |
---|
38 | for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS; |
---|
39 | the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS; |
---|
40 | the_class++ ) |
---|
41 | _Workspace_Free( the_key->Values[ the_class ] ); |
---|
42 | |
---|
43 | /* |
---|
44 | * NOTE: The destructor is not called and it is the responsibility |
---|
45 | * of the application to free the memory. |
---|
46 | */ |
---|
47 | |
---|
48 | _POSIX_Keys_Free( the_key ); |
---|
49 | _Thread_Enable_dispatch(); |
---|
50 | return 0; |
---|
51 | } |
---|
52 | return POSIX_BOTTOM_REACHED(); |
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.