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