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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: keysetspecific.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
int 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
}

powered by: WebSVN 2.1.0

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