Use cond_wait(3C) to atomically release the mutex pointed to by mp and 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().
cond_wait() always returns with the mutex locked and owned by the calling thread, even when returning an error.
#include <thread.h> int cond_wait(cond_t *cv, mutex_t *mp);
cond_wait() returns 0 if successful. When any of the following conditions is detected, cond_wait() fails and returns the corresponding value.
EFAULT
Description:cv points to an illegal address.
EINTR
Description:The wait was interrupted by a signal.