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