uvw 2.12.1
Loading...
Searching...
No Matches
uvw::Condition Class Referencefinal

The Condition wrapper. More...

#include <thread.h>

Inheritance diagram for uvw::Condition:
Collaboration diagram for uvw::Condition:

Public Member Functions

void signal () noexcept
 Signals a condition.
 
void broadcast () noexcept
 Broadcasts a condition.
 
void wait (Mutex &mutex) noexcept
 Waits on a condition.
 
bool timedWait (Mutex &mutex, uint64_t timeout) noexcept
 Waits on a condition.
 
- Public Member Functions inherited from uvw::UnderlyingType< Condition, uv_cond_t >
Looploop () const noexcept
 Gets the loop from which the resource was originated.
 
const uv_cond_t * raw () const noexcept
 Gets the underlying raw data structure.
 
uv_cond_t * raw () noexcept
 Gets the underlying raw data structure.
 

Additional Inherited Members

- Static Public Member Functions inherited from uvw::UnderlyingType< Condition, uv_cond_t >
static std::shared_ptr< Conditioncreate (Args &&...args)
 Creates a new resource of the given type.
 
- Protected Member Functions inherited from uvw::UnderlyingType< Condition, uv_cond_t >

Detailed Description

The Condition wrapper.

Definition at line 275 of file thread.h.

Member Function Documentation

◆ broadcast()

void uvw::Condition::broadcast ( )
noexcept

Broadcasts a condition.

This function shall unblock threads blocked on a condition variable.

◆ signal()

void uvw::Condition::signal ( )
noexcept

Signals a condition.

This function shall unblock at least one of the threads that are blocked on the specified condition variable (if any threads are blocked on it).

◆ timedWait()

bool uvw::Condition::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.

Parameters
mutexA mutex locked by the calling thread, otherwise expect undefined behavior.
timeoutThe maximum time to wait before to return.
Returns
True in case of success, false otherwise.

◆ wait()

void uvw::Condition::wait ( Mutex & mutex)
noexcept

Waits on a condition.

These function atomically releases the mutex and causes the calling thread to block on the condition variable.

Parameters
mutexA mutex locked by the calling thread, otherwise expect undefined behavior.

The documentation for this class was generated from the following file: