Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (n - p) pthread_cond_timedwait(2)
NAME
pthread_cond_timedwait - Causes a thread to wait either for a condition variable to be signaled
or broadcast, or for a specific expiration time
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
32-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/zputdll
64-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/yputdll
H-series and J-series OSS processes that use the Standard POSIX Threads library:
/G/system/zdllnnn/zsptdll
SYNOPSIS
#include <pthread.h> | #include <spthread.h>
/* pthread.h is required to use POSIX User Thread Model library */
/* spthread.h is required to use Standard POSIX Threads library */
int pthread_cond_timedwait(
pthread_cond_t *cond,
pthread_mutex_t *mutex,
const struct timespec *abstime);
PARAMETERS
cond Specifies the condition variable that the calling thread waits on.
mutex Specifies the mutex associated with the condition variable specified by the cond
parameter.
abstime Specifies the absolute time at which the wait expires, if the condition variable
cond has not been signaled or broadcast. See the
pthread_get_expiration_np(2) reference page either online or in the Open Sys-
tem Services System Calls Reference Manual; that function is used to obtain a
value for this parameter. The abstime value is specified in Universal Coordi-
nated Time (UTC).
DESCRIPTION
This function causes a thread to wait until one of the following occurs:
The specified condition variable is signaled or broadcasted.
The current system clock time is greater than or equal to the time specified by the abs-
time parameter.
This function is similar to the pthread_cond_wait( ) function, except that this function can
return before a condition variable is signaled or broadcast if the specified time expires. For more
information, see the pthread_cond_wait(2) reference page either online or in the Open System
Services System Calls Reference Manual.
This function atomically releases the mutex and causes the calling thread to wait on the condi-
tion variable. When the thread regains control after calling pthread_cond_timedwait( ), the
mutex is locked and the thread is the owner, regardless of why the wait ended. If general cance-
lability is enabled, the thread reacquires the mutex (blocking for it if necessary) before the
cleanup handlers are run (or before the exception is raised).
If the current time equals or exceeds the expiration time, this function returns immediately,
releasing and reacquiring the mutex. This function might cause the calling thread to yield (see
the sched_yield(2) reference page either online or in the Open System Services System Calls
527186-023 Hewlett-Packard Company 595