Waits on the condition variable for a limited time.
#include <synch.h> int cond_timedwait ( cond_t *cvp, mutex_t *mp, timestruc_t *abstime );
(IN) Points to the condition variable to wait on.
(IN) Points to a mutually exclusive lock held by the calling thread.
(IN) Points to a structure that specifies the length of time to wait. See timespec_t, which is also called timestruct_t, timespec, and timestrc_t.
If successful, returns zero; otherwise, returns a nonzero error code:
The cond_timedwait function atomically releases the entry lock pointed to by mutex and blocks the calling thread. When the condition is signaled, cond_timedwait returns.
It is the responsibility of the calling thread to re-evaluate the entry condition when cond_timedwait returns. The condition might have been consumed by a different thread between the time when a blocked thread within cond_timedwait awakens.
If the condition is not signaled (with respect to the calling thread) by the specified time, cond_timedwait returns ETIMEDOUT.