Waits on the condition variable.
#include <synch.h> int cond_wait ( cond_t *cvp, mutex_t *mp );
(IN) Points to the condition variable to wait on.
(IN) Points to a mutually exclusive lock held by the calling thread.
If successful, returns zero; otherwise, returns an nonzero error code.
The cond_wait function atomically releases the entry lock pointed to by mutex and blocks the calling thread. When the condition is signaled, cond_wait returns.
It is the responsibility of the calling thread to re-evaluate the entry condition when cond_wait returns. The condition may have been consumed by a different thread between the time when a blocked thread within cond_wait awakens and when it acquires the entry mutex.
The wait can be interrupted, in which case cond_wait returns EINTR. In this case, the entry lock is not held when cond_wait returns.