#include <latch.h>
A class which can be used for barrier scenarios. See e.g. https://en.cppreference.com/w/cpp/thread/latch
Definition at line 26 of file latch.h.
◆ Latch()
dispenso::Latch::Latch |
( |
uint32_t |
threadGroupCount | ) |
|
|
inlineexplicitnoexcept |
Construct a latch with expected number of threads to wait on.
- Parameters
-
threadGroupCount | The number of threads in the group. |
Definition at line 33 of file latch.h.
◆ arrive_and_wait()
void dispenso::Latch::arrive_and_wait |
( |
| ) |
|
|
inlinenoexcept |
Decrement the counter and wait
Definition at line 66 of file latch.h.
◆ count_down()
Decrement the counter in a non-blocking manner.
Definition at line 38 of file latch.h.
◆ try_wait()
bool dispenso::Latch::try_wait |
( |
| ) |
const |
|
inlinenoexcept |
See if the count has been reduced to zero, indicating all necessary threads have synchronized.
- Note
- try_wait is a misnomer, as the function never blocks. We kept the name to match C++20 API.
- Returns
- true only if the internal counter has reached zero.
Definition at line 52 of file latch.h.
◆ wait()
void dispenso::Latch::wait |
( |
| ) |
const |
|
inlinenoexcept |
Wait for all threads to have synchronized.
Definition at line 59 of file latch.h.
The documentation for this class was generated from the following file: