PTHREAD_COND_TIMEDWAIT(3P) SysV PTHREAD_COND_TIMEDWAIT(3P)
NAME
pthread_cond_timedwait - Waits on a condition variable for a specified
period of time
SYNOPSIS
#include <pthread.h>
int pthread_cond_timedwait (cond, mutex, abstime)
pthread_cond_t *cond;
pthread_mutex_t *mutex;
struct timestruct *abstime;
DESCRIPTION
The pthread_cond_timedwait function unlocks the mutex specified by the
mutex argument and causes the calling thread to wait on the specified
condition variable. If the condition is satisfied within the time
specified by the abstime argument, the mutex is relocked and the function
returns. If the absolute time specified by abstime elapses before the
condition is signaled, an error is returned with mutex relocked.
The arguments are as follows:
cond Specifies the condition variable to wait on.
mutex Specifies the mutex in which the condition variable is located;
the mutex must be locked by the calling thread.
abstime Specifies the time in nanoseconds to wait until the condition
variable to be satisfied.
NOTES
This interface is based on draft 4 of the IEEE P1003.4a standard, and
will be changed to conform to the final version.
DIAGNOSTICS
Upon successful completion, a value of 0 (zero) is returned. Otherwise,
-1 is returned and errno is set to indicate the error.
ERRORS
If the pthread_cond_timedwait function fails, errno may be set to one of
the following values:
[EINVAL] The value specified by the mutex, cond, or abstime argument is
invalid.
[EAGAIN] The time specified by abstime has elapsed.
[EDEADLK] The calling thread does not own the mutex.
SEE ALSO
pthread_cond_signal(3P), pthread_cond_broadcast(3P)