Multithreaded Programming Guide

Wait for a Condition


#include <thread.h>

int cond_wait(cond_t *cv, mutex_t *mp);

Use cond_wait(3T) to atomically release the mutex pointed to by mp and to cause the calling thread to block on the condition variable pointed to by cv. The blocked thread can be awakened by cond_signal(), cond_broadcast(), or when interrupted by delivery of a signal or a fork(). (For POSIX threads, see "pthread_cond_wait(3T)".)