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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [posix/] [src/] [keygetspecific.c] - Blame information for rev 1771

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

Line No. Rev Author Line
1 1026 ivang
/*
2
 *  keygetspecific.c,v 1.2 2001/01/24 14:17:28 joel Exp
3
 */
4
 
5
#if HAVE_CONFIG_H
6
#include "config.h"
7
#endif
8
 
9
#include <errno.h>
10
#include <limits.h>
11
#include <pthread.h>
12
#include <string.h>
13
 
14
#include <rtems/system.h>
15
#include <rtems/score/thread.h>
16
#include <rtems/score/wkspace.h>
17
#include <rtems/posix/key.h>
18
 
19
/*PAGE
20
 *
21
 *  17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
22
 */
23
 
24
void *pthread_getspecific(
25
  pthread_key_t  key
26
)
27
{
28
  register POSIX_Keys_Control *the_key;
29
  unsigned32                   index;
30
  unsigned32                   class;
31
  Objects_Locations            location;
32
  void                        *key_data;
33
 
34
  the_key = _POSIX_Keys_Get( key, &location );
35
  switch ( location ) {
36
    case OBJECTS_ERROR:
37
    case OBJECTS_REMOTE:   /* should never happen */
38
      return NULL;
39
    case OBJECTS_LOCAL:
40
      index = _Objects_Get_index( _Thread_Executing->Object.id );
41
      class = _Objects_Get_class( _Thread_Executing->Object.id );
42
      key_data = (void *) the_key->Values[ class ][ index ];
43
      _Thread_Enable_dispatch();
44
      return key_data;
45
  }
46
  return (void *) POSIX_BOTTOM_REACHED();
47
}

powered by: WebSVN 2.1.0

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