source: rtems/cpukit/posix/src/keygetspecific.c @ 0e16fa45

5
Last change on this file since 0e16fa45 was 9ea69dee, checked in by Sebastian Huber <sebastian.huber@…>, on 04/04/16 at 06:18:07

score: Add node map to _RBTree_Find_inline()

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file
3 *
4 * @brief Thread-Specific Data Management
5 * @ingroup POSIXAPI
6 */
7
8/*
9 * Copyright (c) 2012 Zhongwei Yao.
10 * COPYRIGHT (c) 1989-2007.
11 * On-Line Applications Research Corporation (OAR).
12 * Copyright (c) 2016 embedded brains GmbH.
13 *
14 * The license and distribution terms for this file may be
15 * found in the file LICENSE in this distribution or at
16 * http://www.rtems.org/license/LICENSE.
17 */
18
19#if HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <rtems/posix/keyimpl.h>
24
25/*
26 *  17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
27 */
28
29void *pthread_getspecific(
30  pthread_key_t  key
31)
32{
33  Thread_Control            *executing;
34  ISR_lock_Context           lock_context;
35  POSIX_Keys_Key_value_pair *key_value_pair;
36  void                      *value;
37
38  executing = _Thread_Get_executing();
39  _POSIX_Keys_Key_value_acquire( executing, &lock_context );
40
41  key_value_pair = _POSIX_Keys_Key_value_find( key, executing );
42
43  if ( key_value_pair != NULL ) {
44    value = key_value_pair->value;
45  } else {
46    value = NULL;
47  }
48
49  _POSIX_Keys_Key_value_release( executing, &lock_context );
50
51  return value;
52}
Note: See TracBrowser for help on using the repository browser.