Function timedWait


#include <src/uvw/thread.h>

bool timedWait(Mutex &mutex, uint64_t timeout) noexcept


Waits on a condition.

These function atomically releases the mutex and causes the calling thread to block on the condition variable.
The functions returns with an error if the absolute time specified passes (that is, system time equals or exceeds it) before the condition is signaled or broadcasted, or if the absolute time specified has already been passed at the time of the call.


mutex - A mutex locked by the calling thread, otherwise expect undefined behavior.

timeout - The maximum time to wait before to return.

True in case of success, false otherwise.


Lines 198-200 in src/uvw/thread.cpp. Line 334 in src/uvw/thread.h.

UVW_INLINE bool Condition::timedWait(Mutex &mutex, uint64_t timeout) noexcept {
    return (0 == uv_cond_timedwait(get(), mutex.get(), timeout));

Add Discussion as Guest

Log in