Atomically unlock the mutex and wait until this condition is signaled.
Synopsis
Declared in <bslmt_conditionimpl_pthread.h>
int
wait(Mutex* mutex);
Description
Atomically unlock the specified mutex and suspend execution of the current thread until this condition object is "signaled" (i.e., either signal or broadcast is invoked on this object in another thread), then re‐acquire a lock on the mutex. Return 0 on success, and a non‐zero value otherwise. Spurious wakeups are rare but possible; i.e., this method may succeed (return 0), and return control to the thread without the condition object being signaled. The behavior is undefined unless mutex is locked by the calling thread prior to calling this method. Note that mutex remains locked by the calling thread upon return from this function.
Return Value
0 on success, and a non‐zero value otherwise
Parameters
Name |
Description |
mutex |
mutex held by the calling thread; unlocked while waiting |
Created with MrDocs