[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


cma_cond_timed_wait

Causes a thread to wait for a condition variable to be signaled or broadcasted for a specified period of time.

Syntax

cma_cond_timed_wait(
                    condition,
                    mutex,
                    expiration);
 


Argument Data Type Access

condition opaque cma_t_cond read mutex opaque cma_t_mutex read expiration opaque cma_t_date_time read


C Binding

#include 

cma_t_status cma_cond_timed_wait ( cma_t_cond *condition, cma_t_mutex *mutex, cma_t_date_time *expiration);

Arguments

condition
Handle of the condition variable on which the thread waits.
mutex
Mutex associated with the condition variable specified in condition.
expiration
Absolute time at which the wait should expire, if the condition has not yet been signaled or broadcasted. (See the cma_time_get_ expiration routine, which can be used to obtain a value for this argument.)

Description

This routine causes a thread to wait until:

This routine is identical to cma_cond_wait except that this routine can return before a condition variable is signaled or broadcasted, specifically, when a specified time expires.

Valid return values are cma_s_normal and cma_s_timed_out. If the wait is completed normally by a signal or broadcast on the condition variable, the return status is cma_s_normal. If the wait completes because the expiration time has passed, the return status is cma_s_ timed_out.

If the current time equals or exceeds the expiration time, this routine returns immediately, without causing the current thread to wait. Your code should check the return status whenever this routine returns and take the appropriate action. Otherwise, waiting on the condition variable can become a nonblocking loop.

Call this routine after you have locked the mutex specified in mutex. The results of this routine are unpredictable if this routine is called without first locking the mutex.

Exceptions

cma_e_alerted
cma_e_existence
cma_e_use_error



[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]