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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: keygetspecific.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.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
18
 */
19
 
20
void *pthread_getspecific(
21
  pthread_key_t  key
22
)
23
{
24
  register POSIX_Keys_Control *the_key;
25
  unsigned32                   index;
26
  unsigned32                   class;
27
  Objects_Locations            location;
28
  void                        *key_data;
29
 
30
  the_key = _POSIX_Keys_Get( key, &location );
31
  switch ( location ) {
32
    case OBJECTS_ERROR:
33
    case OBJECTS_REMOTE:   /* should never happen */
34
      return NULL;
35
    case OBJECTS_LOCAL:
36
      index = _Objects_Get_index( _Thread_Executing->Object.id );
37
      class = _Objects_Get_class( _Thread_Executing->Object.id );
38
      key_data = (void *) the_key->Values[ class ][ index ];
39
      _Thread_Enable_dispatch();
40
      return key_data;
41
  }
42
  return (void *) POSIX_BOTTOM_REACHED();
43
}

powered by: WebSVN 2.1.0

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