1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief POSIX Key Private Support |
---|
5 | * |
---|
6 | * This include file contains all the private support information for |
---|
7 | * POSIX key. |
---|
8 | */ |
---|
9 | |
---|
10 | /* |
---|
11 | * Copyright (c) 2012 Zhongwei Yao. |
---|
12 | * COPYRIGHT (c) 1989-2011. |
---|
13 | * On-Line Applications Research Corporation (OAR). |
---|
14 | * |
---|
15 | * The license and distribution terms for this file may be |
---|
16 | * found in the file LICENSE in this distribution or at |
---|
17 | * http://www.rtems.org/license/LICENSE. |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef _RTEMS_POSIX_KEY_H |
---|
21 | #define _RTEMS_POSIX_KEY_H |
---|
22 | |
---|
23 | #include <pthread.h> |
---|
24 | |
---|
25 | #include <rtems/score/chain.h> |
---|
26 | #include <rtems/score/object.h> |
---|
27 | #include <rtems/score/rbtree.h> |
---|
28 | #include <rtems/score/thread.h> |
---|
29 | |
---|
30 | #ifdef __cplusplus |
---|
31 | extern "C" { |
---|
32 | #endif |
---|
33 | |
---|
34 | /** |
---|
35 | * @defgroup POSIX_KEY POSIX Key |
---|
36 | * |
---|
37 | * @ingroup POSIXAPI |
---|
38 | * |
---|
39 | */ |
---|
40 | /**@{**/ |
---|
41 | |
---|
42 | /** |
---|
43 | * @brief Represents POSIX key and value pair. |
---|
44 | */ |
---|
45 | typedef struct { |
---|
46 | /** |
---|
47 | * @brief The chain node for the per-thread value chain. |
---|
48 | */ |
---|
49 | Chain_Node Key_values_per_thread_node; |
---|
50 | |
---|
51 | /** |
---|
52 | * @brief The tree node for the lookup tree. |
---|
53 | */ |
---|
54 | RBTree_Node Key_value_lookup_node; |
---|
55 | |
---|
56 | /** |
---|
57 | * @brief The POSIX key identifier used in combination with the thread |
---|
58 | * pointer as the tree key. |
---|
59 | */ |
---|
60 | pthread_key_t key; |
---|
61 | |
---|
62 | /** |
---|
63 | * @brief The thread pointer used in combination with the POSIX key |
---|
64 | * identifier as the tree key. |
---|
65 | */ |
---|
66 | Thread_Control *thread; |
---|
67 | |
---|
68 | /** |
---|
69 | * @brief The thread specific POSIX key value. |
---|
70 | */ |
---|
71 | const void *value; |
---|
72 | } POSIX_Keys_Key_value_pair; |
---|
73 | |
---|
74 | /** |
---|
75 | * @brief The data structure used to manage a POSIX key. |
---|
76 | */ |
---|
77 | typedef struct { |
---|
78 | /** This field is the Object control structure. */ |
---|
79 | Objects_Control Object; |
---|
80 | /** This field is the data destructor. */ |
---|
81 | void (*destructor) (void *); |
---|
82 | } POSIX_Keys_Control; |
---|
83 | |
---|
84 | /** @} */ |
---|
85 | |
---|
86 | #ifdef __cplusplus |
---|
87 | } |
---|
88 | #endif |
---|
89 | |
---|
90 | #endif |
---|
91 | /* end of include file */ |
---|