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