A synchronization aid that allows one thread to wait until an operation being performed in other thread completes.
More...
#include <latch.hpp>
|
| Latch () |
|
void | set () |
| Sets an event occurred. More...
|
|
void | wait () |
| Waits for a single occurrence of event. More...
|
|
bool | wait (const unsigned int timeoutMs) |
| Waits for a single occurrence of event with timeout. More...
|
|
void | waitForN (const unsigned int n) |
| Waits for
occurrences of event. More...
|
|
bool | waitForN (const unsigned int n, const unsigned int timeoutMs) |
| Waits for
occurrences of event with timeout. More...
|
|
bool | empty () |
| Check if there are no pending events. More...
|
|
A synchronization aid that allows one thread to wait until an operation being performed in other thread completes.
It has a similar function as std::promise<void> but allows multiple calls to set.
bool utils::Latch::empty |
( |
| ) |
|
Check if there are no pending events.
void utils::Latch::set |
( |
| ) |
|
void utils::Latch::wait |
( |
| ) |
|
Waits for a single occurrence of event.
bool utils::Latch::wait |
( |
const unsigned int |
timeoutMs | ) |
|
Waits for a single occurrence of event with timeout.
- Parameters
-
timeoutMs | timeout in ms to wait for |
- Returns
- false on timeout
void utils::Latch::waitForN |
( |
const unsigned int |
n | ) |
|
Waits for
occurrences of event.
- Parameters
-
n | number of occurrences to wait for |
bool utils::Latch::waitForN |
( |
const unsigned int |
n, |
|
|
const unsigned int |
timeoutMs |
|
) |
| |
Waits for
occurrences of event with timeout.
- Parameters
-
n | number of occurrences to wait for |
timeoutMs | timeout in ms to wait for |
- Returns
- false on timeout
std::condition_variable utils::Latch::mCondition |
|
private |
unsigned int utils::Latch::mCount |
|
private |
std::mutex utils::Latch::mMutex |
|
private |
The documentation for this class was generated from the following files: