The Condition wrapper.
More...
#include <thread.h>
|
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.
|
|
Loop & | loop () 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.
|
|
|
static std::shared_ptr< Condition > | create (Args &&...args) |
| Creates a new resource of the given type.
|
|
The Condition wrapper.
Definition at line 275 of file thread.h.
◆ 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
-
mutex | A mutex locked by the calling thread, otherwise expect undefined behavior. |
timeout | The 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
-
mutex | A mutex locked by the calling thread, otherwise expect undefined behavior. |
The documentation for this class was generated from the following file: