Self-resetting synchronization barrier for threads.
More...
#include <barrier.hpp>
|
| Barrier (unsigned n) |
| Construct a new Barrier object to syncronize n threads. More...
|
|
void | wait () |
| wait for the other threads to reach the barrier.
|
|
void | wait (std::function< void()> fun) |
| wait for the other treads to reach the barrier and exec fun bebore notyfying others if you are the last thread to reach it. More...
|
|
void | busy_wait () |
| busy wait for other threads to reach the barrier.
|
|
void | busy_wait (std::function< void()> fun) |
| busy wait for the other treads to reach the barrier and exec fun bebore notyfying others if you are the last thread to reach it. More...
|
|
Self-resetting synchronization barrier for threads.
- Note
- The barrier self resets so that it can be reused.
◆ Barrier()
ca::Barrier::Barrier |
( |
unsigned |
n | ) |
|
|
explicit |
Construct a new Barrier object to syncronize n threads.
- Parameters
-
n | number of threads to syncronize. |
- Exceptions
-
invalid_argument | if n is equal to zero. |
◆ busy_wait()
void ca::Barrier::busy_wait |
( |
std::function< void()> |
fun | ) |
|
busy wait for the other treads to reach the barrier and exec fun bebore notyfying others if you are the last thread to reach it.
- Parameters
-
fun | function that the last thread to reach the barrier will execute before notifying. |
◆ wait()
void ca::Barrier::wait |
( |
std::function< void()> |
fun | ) |
|
wait for the other treads to reach the barrier and exec fun bebore notyfying others if you are the last thread to reach it.
- Parameters
-
fun | function that the last thread to reach the barrier will execute before notifying. |
The documentation for this class was generated from the following files: