source: rtems-docs/posix_users/condition_variable.rst @ ed3794e

4.115
Last change on this file since ed3794e was d389819, checked in by Amar Takhar <amar@…>, on 01/18/16 at 05:37:40

Convert all Unicode to ASCII(128)

  • Property mode set to 100644
File size: 6.9 KB
Line 
1Condition Variable Manager
2##########################
3
4Introduction
5============
6
7The condition variable manager ...
8
9The directives provided by the condition variable manager are:
10
11- ``pthread_condattr_init`` - Initialize a Condition Variable Attribute Set
12
13- ``pthread_condattr_destroy`` - Destroy a Condition Variable Attribute Set
14
15- ``pthread_condattr_setpshared`` - Set Process Shared Attribute
16
17- ``pthread_condattr_getpshared`` - Get Process Shared Attribute
18
19- ``pthread_cond_init`` - Initialize a Condition Variable
20
21- ``pthread_cond_destroy`` - Destroy a Condition Variable
22
23- ``pthread_cond_signal`` - Signal a Condition Variable
24
25- ``pthread_cond_broadcast`` - Broadcast a Condition Variable
26
27- ``pthread_cond_wait`` - Wait on a Condition Variable
28
29- ``pthread_cond_timedwait`` - With with Timeout a Condition Variable
30
31Background
32==========
33
34There is currently no text in this section.
35
36Operations
37==========
38
39There is currently no text in this section.
40
41Directives
42==========
43
44This section details the condition variable manager's directives.
45A subsection is dedicated to each of this manager's directives
46and describes the calling sequence, related constants, usage,
47and status codes.
48
49pthread_condattr_init - Initialize a Condition Variable Attribute Set
50---------------------------------------------------------------------
51.. index:: pthread_condattr_init
52.. index:: initialize a condition variable attribute set
53
54**CALLING SEQUENCE:**
55
56.. code:: c
57
58    #include <pthread.h>
59    int pthread_condattr_init(
60    pthread_condattr_t \*attr
61    );
62
63**STATUS CODES:**
64
65*ENOMEM*
66    Insufficient memory is available to initialize the condition variable
67    attributes object.
68
69**DESCRIPTION:**
70
71**NOTES:**
72
73pthread_condattr_destroy - Destroy a Condition Variable Attribute Set
74---------------------------------------------------------------------
75.. index:: pthread_condattr_destroy
76.. index:: destroy a condition variable attribute set
77
78**CALLING SEQUENCE:**
79
80.. code:: c
81
82    #include <pthread.h>
83    int pthread_condattr_destroy(
84    pthread_condattr_t \*attr
85    );
86
87**STATUS CODES:**
88
89*EINVAL*
90    The attribute object specified is invalid.
91
92**DESCRIPTION:**
93
94**NOTES:**
95
96pthread_condattr_setpshared - Set Process Shared Attribute
97----------------------------------------------------------
98.. index:: pthread_condattr_setpshared
99.. index:: set process shared attribute
100
101**CALLING SEQUENCE:**
102
103.. code:: c
104
105    #include <pthread.h>
106    int pthread_condattr_setpshared(
107    pthread_condattr_t \*attr,
108    int                 pshared
109    );
110
111**STATUS CODES:**
112
113*EINVAL*
114    Invalid argument passed.
115
116**DESCRIPTION:**
117
118**NOTES:**
119
120pthread_condattr_getpshared - Get Process Shared Attribute
121----------------------------------------------------------
122.. index:: pthread_condattr_getpshared
123.. index:: get process shared attribute
124
125**CALLING SEQUENCE:**
126
127.. code:: c
128
129    #include <pthread.h>
130    int pthread_condattr_getpshared(
131    const pthread_condattr_t \*attr,
132    int                      \*pshared
133    );
134
135**STATUS CODES:**
136
137*EINVAL*
138    Invalid argument passed.
139
140**DESCRIPTION:**
141
142**NOTES:**
143
144pthread_cond_init - Initialize a Condition Variable
145---------------------------------------------------
146.. index:: pthread_cond_init
147.. index:: initialize a condition variable
148
149**CALLING SEQUENCE:**
150
151.. code:: c
152
153    #include <pthread.h>
154    int pthread_cond_init(
155    pthread_cond_t           \*cond,
156    const pthread_condattr_t \*attr
157    );
158
159**STATUS CODES:**
160
161*EAGAIN*
162    The system lacked a resource other than memory necessary to create the
163    initialize the condition variable object.
164
165*ENOMEM*
166    Insufficient memory is available to initialize the condition variable object.
167
168*EBUSY*
169    The specified condition variable has already been initialized.
170
171*EINVAL*
172    The specified attribute value is invalid.
173
174**DESCRIPTION:**
175
176**NOTES:**
177
178pthread_cond_destroy - Destroy a Condition Variable
179---------------------------------------------------
180.. index:: pthread_cond_destroy
181.. index:: destroy a condition variable
182
183**CALLING SEQUENCE:**
184
185.. code:: c
186
187    #include <pthread.h>
188    int pthread_cond_destroy(
189    pthread_cond_t \*cond
190    );
191
192**STATUS CODES:**
193
194*EINVAL*
195    The specified condition variable is invalid.
196
197*EBUSY*
198    The specified condition variable is currently in use.
199
200**DESCRIPTION:**
201
202**NOTES:**
203
204pthread_cond_signal - Signal a Condition Variable
205-------------------------------------------------
206.. index:: pthread_cond_signal
207.. index:: signal a condition variable
208
209**CALLING SEQUENCE:**
210
211.. code:: c
212
213    #include <pthread.h>
214    int pthread_cond_signal(
215    pthread_cond_t \*cond
216    );
217
218**STATUS CODES:**
219
220*EINVAL*
221    The specified condition variable is not valid.
222
223**DESCRIPTION:**
224
225**NOTES:**
226
227This routine should not be invoked from a handler from an asynchronous signal
228handler or an interrupt service routine.
229
230pthread_cond_broadcast - Broadcast a Condition Variable
231-------------------------------------------------------
232.. index:: pthread_cond_broadcast
233.. index:: broadcast a condition variable
234
235**CALLING SEQUENCE:**
236
237.. code:: c
238
239    #include <pthread.h>
240    int pthread_cond_broadcast(
241    pthread_cond_t \*cond
242    );
243
244**STATUS CODES:**
245
246*EINVAL*
247    The specified condition variable is not valid.
248
249**DESCRIPTION:**
250
251**NOTES:**
252
253This routine should not be invoked from a handler from an asynchronous signal
254handler or an interrupt service routine.
255
256pthread_cond_wait - Wait on a Condition Variable
257------------------------------------------------
258.. index:: pthread_cond_wait
259.. index:: wait on a condition variable
260
261**CALLING SEQUENCE:**
262
263.. code:: c
264
265    #include <pthread.h>
266    int pthread_cond_wait(
267    pthread_cond_t \*cond,
268    pthread_mutex_t \*mutex
269    );
270
271**STATUS CODES:**
272
273*EINVAL*
274    The specified condition variable or mutex is not initialized OR different
275    mutexes were specified for concurrent pthread_cond_wait() and
276    pthread_cond_timedwait() operations on the same condition variable OR
277    the mutex was not owned by the current thread at the time of the call.
278
279**DESCRIPTION:**
280
281**NOTES:**
282
283pthread_cond_timedwait - Wait with Timeout a Condition Variable
284---------------------------------------------------------------
285.. index:: pthread_cond_timedwait
286.. index:: wait with timeout a condition variable
287
288**CALLING SEQUENCE:**
289
290.. code:: c
291
292    #include <pthread.h>
293    int pthread_cond_timedwait(
294    pthread_cond_t        \*cond,
295    pthread_mutex_t       \*mutex,
296    const struct timespec \*abstime
297    );
298
299**STATUS CODES:**
300
301*EINVAL*
302    The specified condition variable or mutex is not initialized OR different
303    mutexes were specified for concurrent pthread_cond_wait() and
304    pthread_cond_timedwait() operations on the same condition variable OR
305    the mutex was not owned by the current thread at the time of the call.
306
307*ETIMEDOUT*
308    The specified time has elapsed without the condition variable being
309    satisfied.
310
311**DESCRIPTION:**
312
313**NOTES:**
314
315.. COMMENT: COPYRIGHT (c) 1988-2002.
316
317.. COMMENT: On-Line Applications Research Corporation (OAR).
318
319.. COMMENT: All rights reserved.
320
Note: See TracBrowser for help on using the repository browser.