OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [keydelete.c] - Blame information for rev 532

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: keydelete.c,v 1.2 2001-09-27 11:59:17 chris Exp $
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
        if ( the_key->Values[ the_class ] )
42
          _Workspace_Free( the_key->Values[ the_class ] );
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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.