source: rtems/cpukit/posix/src/keydelete.c @ 70af0ea1

4.104.114.84.95
Last change on this file since 70af0ea1 was 70af0ea1, checked in by Joel Sherrill <joel.sherrill@…>, on 01/10/00 at 18:47:58

Don't look at the object information structure for threads/tasks
for APIs that are not configured. This resulted in weird behavior
when ITRON was disabled on some targets.

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[63edcf24]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
20int 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++ )
[70af0ea1]41        if ( the_key->Values[ the_class ] )
42          _Workspace_Free( the_key->Values[ the_class ] );
[63edcf24]43
44      /*
45       *  NOTE:  The destructor is not called and it is the responsibility
46       *         of the application to free the memory.
47       */
48
49      _POSIX_Keys_Free( the_key );
50      _Thread_Enable_dispatch();
51      return 0;
52  }
53  return POSIX_BOTTOM_REACHED();
54}
Note: See TracBrowser for help on using the repository browser.