cnd_wait - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# cnd_wait

From cppreference.com
< c‎ | thread

Defined in header `<threads.h>` |  |
int cnd_wait( cnd_t* cond, mtx_t* mutex ); |  | (since C11)

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. The mutex is locked again before the function returns.

The behavior is undefined if the mutex is not already locked by the calling thread.

### [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] See also

cnd_timedwait (C11) | blocks on a condition variable, with a timeout (function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/thread/cnd_wait&oldid=63544"