source: rtems/cpukit/posix/src/keysetspecific.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: 1008 bytes
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
20int pthread_setspecific(
21  pthread_key_t  key,
22  const void    *value
23)
24{
25  register POSIX_Keys_Control *the_key;
26  unsigned32                   index;
27  unsigned32                   class;
28  Objects_Locations            location;
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 EINVAL;
35    case OBJECTS_LOCAL:
36      index = _Objects_Get_index( _Thread_Executing->Object.id );
37      class = _Objects_Get_class( _Thread_Executing->Object.id );
38      the_key->Values[ class ][ index ] = (void *) value;
39      _Thread_Enable_dispatch();
40      return 0;
41  }
42  return POSIX_BOTTOM_REACHED();
43}
Note: See TracBrowser for help on using the repository browser.