source: rtems/cpukit/posix/src/keygetspecific.c @ 63edcf24

4.104.114.84.95
Last change on this file since 63edcf24 was 63edcf24, checked in by Joel Sherrill <joel.sherrill@…>, on 11/02/99 at 18:40:30

Split key.c into multiple files.

  • Property mode set to 100644
File size: 1.0 KB
Line 
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.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
18 */
19
20void *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}
Note: See TracBrowser for help on using the repository browser.