1 | /** |
---|
2 | * @file rtems/posix/cond.h |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * This include file contains all the private support information for |
---|
7 | * POSIX condition variables. |
---|
8 | * |
---|
9 | * COPYRIGHT (c) 1989-1999. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _RTEMS_POSIX_COND_H |
---|
20 | #define _RTEMS_POSIX_COND_H |
---|
21 | |
---|
22 | #ifdef __cplusplus |
---|
23 | extern "C" { |
---|
24 | #endif |
---|
25 | |
---|
26 | #include <rtems/score/object.h> |
---|
27 | #include <rtems/score/threadq.h> |
---|
28 | |
---|
29 | /* |
---|
30 | * Constant to indicate condition variable does not currently have |
---|
31 | * a mutex assigned to it. |
---|
32 | */ |
---|
33 | |
---|
34 | #define POSIX_CONDITION_VARIABLES_NO_MUTEX 0 |
---|
35 | |
---|
36 | /* |
---|
37 | * Data Structure used to manage a POSIX condition variable |
---|
38 | */ |
---|
39 | |
---|
40 | typedef struct { |
---|
41 | Objects_Control Object; |
---|
42 | int process_shared; |
---|
43 | pthread_mutex_t Mutex; |
---|
44 | Thread_queue_Control Wait_queue; |
---|
45 | } POSIX_Condition_variables_Control; |
---|
46 | |
---|
47 | /* |
---|
48 | * The following defines the information control block used to manage |
---|
49 | * this class of objects. |
---|
50 | */ |
---|
51 | |
---|
52 | POSIX_EXTERN Objects_Information _POSIX_Condition_variables_Information; |
---|
53 | |
---|
54 | /* |
---|
55 | * The default condition variable attributes structure. |
---|
56 | */ |
---|
57 | |
---|
58 | extern const pthread_condattr_t _POSIX_Condition_variables_Default_attributes; |
---|
59 | |
---|
60 | /* |
---|
61 | * _POSIX_Condition_variables_Manager_initialization |
---|
62 | * |
---|
63 | * DESCRIPTION: |
---|
64 | * |
---|
65 | * This routine performs the initialization necessary for this manager. |
---|
66 | */ |
---|
67 | |
---|
68 | void _POSIX_Condition_variables_Manager_initialization( |
---|
69 | uint32_t maximum_condition_variables |
---|
70 | ); |
---|
71 | |
---|
72 | /* |
---|
73 | * _POSIX_Condition_variables_Allocate |
---|
74 | * |
---|
75 | * DESCRIPTION: |
---|
76 | * |
---|
77 | * This function allocates a condition variable control block from |
---|
78 | * the inactive chain of free condition variable control blocks. |
---|
79 | */ |
---|
80 | |
---|
81 | RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control * |
---|
82 | _POSIX_Condition_variables_Allocate( void ); |
---|
83 | |
---|
84 | /* |
---|
85 | * _POSIX_Condition_variables_Free |
---|
86 | * |
---|
87 | * DESCRIPTION: |
---|
88 | * |
---|
89 | * This routine frees a condition variable control block to the |
---|
90 | * inactive chain of free condition variable control blocks. |
---|
91 | */ |
---|
92 | |
---|
93 | RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free ( |
---|
94 | POSIX_Condition_variables_Control *the_condition_variable |
---|
95 | ); |
---|
96 | |
---|
97 | /* |
---|
98 | * _POSIX_Condition_variables_Get |
---|
99 | * |
---|
100 | * DESCRIPTION: |
---|
101 | * |
---|
102 | * This function maps condition variable IDs to condition variable control |
---|
103 | * blocks. If ID corresponds to a local condition variable, then it returns |
---|
104 | * the_condition variable control pointer which maps to ID and location |
---|
105 | * is set to OBJECTS_LOCAL. if the condition variable ID is global and |
---|
106 | * resides on a remote node, then location is set to OBJECTS_REMOTE, |
---|
107 | * and the_condition variable is undefined. Otherwise, location is set |
---|
108 | * to OBJECTS_ERROR and the_condition variable is undefined. |
---|
109 | */ |
---|
110 | |
---|
111 | #if 0 |
---|
112 | RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get ( |
---|
113 | Objects_Id *id, |
---|
114 | Objects_Locations *location |
---|
115 | ); |
---|
116 | #endif |
---|
117 | |
---|
118 | /* |
---|
119 | * _POSIX_Condition_variables_Is_null |
---|
120 | * |
---|
121 | * DESCRIPTION: |
---|
122 | * |
---|
123 | * This function returns TRUE if the_condition variable is NULL |
---|
124 | * and FALSE otherwise. |
---|
125 | */ |
---|
126 | |
---|
127 | RTEMS_INLINE_ROUTINE boolean _POSIX_Condition_variables_Is_null ( |
---|
128 | POSIX_Condition_variables_Control *the_condition_variable |
---|
129 | ); |
---|
130 | |
---|
131 | /* |
---|
132 | * _POSIX_Condition_variables_Signal_support |
---|
133 | * |
---|
134 | * DESCRIPTION: |
---|
135 | * |
---|
136 | * A support routine which implements guts of the broadcast and single task |
---|
137 | * wake up version of the "signal" operation. |
---|
138 | */ |
---|
139 | |
---|
140 | int _POSIX_Condition_variables_Signal_support( |
---|
141 | pthread_cond_t *cond, |
---|
142 | boolean is_broadcast |
---|
143 | ); |
---|
144 | |
---|
145 | /* |
---|
146 | * _POSIX_Condition_variables_Wait_support |
---|
147 | * |
---|
148 | * DESCRIPTION: |
---|
149 | * |
---|
150 | * A support routine which implements guts of the blocking, non-blocking, and |
---|
151 | * timed wait version of condition variable wait routines. |
---|
152 | */ |
---|
153 | |
---|
154 | int _POSIX_Condition_variables_Wait_support( |
---|
155 | pthread_cond_t *cond, |
---|
156 | pthread_mutex_t *mutex, |
---|
157 | Watchdog_Interval timeout, |
---|
158 | boolean already_timedout |
---|
159 | ); |
---|
160 | |
---|
161 | /* |
---|
162 | * _POSIX_Condition_variables_Get |
---|
163 | * |
---|
164 | * DESCRIPTION: |
---|
165 | * |
---|
166 | * A support routine which translates the condition variable id into |
---|
167 | * a local pointer. As a side-effect, it may create the condition |
---|
168 | * variable. |
---|
169 | */ |
---|
170 | |
---|
171 | POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get ( |
---|
172 | pthread_cond_t *cond, |
---|
173 | Objects_Locations *location |
---|
174 | ); |
---|
175 | |
---|
176 | #include <rtems/posix/cond.inl> |
---|
177 | |
---|
178 | #ifdef __cplusplus |
---|
179 | } |
---|
180 | #endif |
---|
181 | |
---|
182 | #endif |
---|
183 | /* end of include file */ |
---|