source: rtems/cpukit/posix/src/keydelete.c @ 77c330ce

4.115
Last change on this file since 77c330ce was 77c330ce, checked in by Joel Sherrill <joel.sherrill@…>, on 07/26/10 at 22:03:18

2010-07-26 Joel Sherrill <joel.sherrill@…>

  • libcsupport/src/privateenv.c, libmisc/cpuuse/cpuusagereport.c, posix/Makefile.am, posix/include/rtems/posix/key.h, posix/src/keycreate.c, posix/src/keydelete.c, score/src/iterateoverthreads.c: Since removing ITRON, the loop over all APIs for tasks has a path that cannot be reached. Either modify the code or mark tests for NULL as RTEMS_DEBUG.
  • posix/src/keyfreememory.c: New file.
  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2007.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <errno.h>
17#include <limits.h>
18#include <pthread.h>
19#include <string.h>
20
21#include <rtems/system.h>
22#include <rtems/score/thread.h>
23#include <rtems/score/wkspace.h>
24#include <rtems/posix/key.h>
25
26/*
27 *  17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167
28 */
29int pthread_key_delete(
30  pthread_key_t  key
31)
32{
33  POSIX_Keys_Control *the_key;
34  Objects_Locations   location;
35
36  the_key = _POSIX_Keys_Get( key, &location );
37  switch ( location ) {
38
39    case OBJECTS_LOCAL:
40      _Objects_Close( &_POSIX_Keys_Information, &the_key->Object );
41
42      _POSIX_Keys_Free_memory( the_key );
43
44      /*
45       *  NOTE:  The destructor is not called and it is the responsibility
46       *         of the application to free the memory.
47       */
48      _POSIX_Keys_Free( the_key );
49      _Thread_Enable_dispatch();
50      return 0;
51
52#if defined(RTEMS_MULTIPROCESSING)
53    case OBJECTS_REMOTE:   /* should never happen */
54#endif
55    case OBJECTS_ERROR:
56      break;
57  }
58
59  return EINVAL;
60}
Note: See TracBrowser for help on using the repository browser.