f_pthread_cond_timedwait(cond, mutex, timeout)

Purpose

This function can be used to wait for a certain condition to occur. The argument mutex must be locked before calling this function. The mutex is unlocked atomically and the calling thread waits for the condition to occur. The argument timeout specifies a deadline before which the condition must occur. If the deadline is reached before the condition occurs, the function will return an error code. This function provides a cancelation point in that the calling thread can be canceled if it is in the enabled state.

The argument timeout will specify an absolute date of the form: Oct. 31 10:00:53, 1998. For related information, see f_maketime and f_timespec.

Class

Function

Argument Type and Attributes

cond
TYPE(f_pthread_cond_t), INTENT(INOUT)

mutex
TYPE(f_pthread_mutex_t), INTENT(INOUT)

timeout
TYPE(f_timespec), INTENT(IN)

Result Type and Attributes

INTEGER(4)

Result Value

On successful completion, this function returns 0. Otherwise this function returns one of the following errors:

EINVAL
The argument cond, mutex, or timeout is invalid.

ETIMEDOUT
The waiting deadline was reached before the condition occurred.
IBM Copyright 2003