source: rtems-docs/posix-users/condition_variable.rst @ 12dccfe

5
Last change on this file since 12dccfe was 12dccfe, checked in by Sebastian Huber <sebastian.huber@…>, on 01/09/19 at 15:14:05

Remove superfluous "All rights reserved."

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