Causes a thread to wait for a condition variable to be signaled or broadcasted.
cma_cond_wait( condition, mutex);
Argument Data Type Accesscondition opaque cma_t_cond read mutex opaque cma_t_mutex read
#includevoid cma_cond_wait ( cma_t_cond *condition, cma_t_mutex *mutex);
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.
This routine atomically releases the mutex and causes the calling thread to wait on the condition. If the wait is satisfied as a result of some thread calling cma_cond_signal or cma_cond_broadcast, the mutex is reacquired and the routine returns.
As a general rule, a thread that has changed the state of storage protected by the mutex in such a way that a predicate associated with a condition variable might now be true must call either cma_ cond_signal or cma_cond_broadcast for that condition variable. If neither call is made, any thread waiting on the condition variable continues to wait.
This routine is alertable. Alertable means that a pending alert is noticed during the wait on the condition variable. This helps ensure that all long waits can be canceled by alerting the thread.
If the cma_e_alerted exception is raised, the mutex is reacquired before the exception is raised.
This routine might (with low probability) return when the condition variable has not been signaled or broadcasted. When a spurious wakeup occurs, the mutex is reacquired before the routine returns. (To handle this type of situation, this routine should always be enclosed in a loop that tests for the desired shared data state.)
cma_e_alerted cma_e_existence cma_e_use_error