pthread_cond_timedwait() returns zero after completing successfully. Any other return value indicates that an error occurred. When either of the following conditions occurs, the function fails and returns the corresponding value.
cv, mp, or abstime points to an illegal address.
Different mutexes were supplied for concurrent pthread_cond_timedwait() operations on the same condition variable.
The time specified by abstime has passed.
The mutex was not owned by the current thread at the time of the call.
The timeout is specified as a time of day so that the condition can be retested efficiently without recomputing the value, as shown in Example 4–9.