Wait for a condition to be signaled.
The condition variable and mutex must be valid, and the mutex must already be held (locked) by the calling thread. Furthermore, the condition variable must not be used concurrently with different mutexes.
- Note
- On some platforms, a spurious wakeup may occur, causing this function to return as if the condition was signaled (when it actually was not). It is strongly encouraged for the caller to test for a separate flag to know for sure whether the signal is meaningful.
- Parameters
-
cond | Condition for which to wait. Must not be NULL. |
mtx | Locked mutex associated with condition. Must not be NULL. |
timeout | Maximum time to wait, in milliseconds. |
- Returns
- Return value is one of:
- PCRSTATUS_OK: Condition was signaled.
- PCRSTATUS_TIMEOUT: Timeout reached; condition was not signaled.