cnd_wait
From cppreference.com
C
Concurrency support (C11)
Concurrency support library
Threads
Atomic operations
(until C23)
Atomic flags
Memory ordering
Mutual exclusion
Condition variables
Thread-local storage
Defined in header
<threads.h>
Atomically unlocks the mutex pointed to by mutex
and blocks on the condition variable pointed to by cond
until the thread is signalled by cnd_signal or cnd_broadcast , or until a spurious wake-up occurs. The mutex is locked again before the function returns.
The behavior is undefined if the mutex is not already locked by the calling thread.
Contents
[edit] Parameters
cond
-
pointer to the condition variable to block on
mutex
-
pointer to the mutex to unlock for the duration of the block
[edit] Return value
thrd_success if successful, thrd_error otherwise.
[edit] References
- C17 standard (ISO/IEC 9899:2018):
- 7.26.3.6 The cnd_wait function (p: 277)
- C11 standard (ISO/IEC 9899:2011):
- 7.26.3.6 The cnd_wait function (p: 380)
[edit] See also
C++ documentation for condition_variable::wait
C++ documentation for condition_variable_any::wait