#include <worldmutex.h>
|
| | Barrier (int nthread) |
| |
| bool | enter (const int id) |
| | Each thread calls this with its id (0,..,nthread-1) to enter the barrier.
|
| |
| void | register_thread (int id, std::atomic< bool > *pflag) |
| | Each thread calls this once before first use.
|
| |
◆ Barrier()
| madness::Barrier::Barrier |
( |
int |
nthread | ) |
|
|
inline |
◆ enter()
| bool madness::Barrier::enter |
( |
const int |
id | ) |
|
|
inline |
Each thread calls this with its id (0,..,nthread-1) to enter the barrier.
The thread last to enter the barrier returns true. Others return false.
All calls to the barrier must use the same value of nthread.
References madness::cpu_relax(), madness::AtomicInt::dec_and_test(), MADNESS_EXCEPTION, MADNESS_MEMORY_LOAD_BARRIER, MADNESS_MEMORY_STORE_BARRIER, MAX_NTHREAD, nthread, nworking, pflags, and sense.
Referenced by madness::TaskThreadEnv::barrier().
◆ register_thread()
| void madness::Barrier::register_thread |
( |
int |
id, |
|
|
std::atomic< bool > * |
pflag |
|
) |
| |
|
inline |
Each thread calls this once before first use.
id should be the thread id (0,..,nthread-1) and pflag a pointer to a thread-local atomic flag (probably in the thread's stack)
References MADNESS_EXCEPTION, MAX_NTHREAD, pflags, and sense.
◆ MAX_NTHREAD
| const int madness::Barrier::MAX_NTHREAD = 128 |
|
staticprivate |
◆ nthread
| const int madness::Barrier::nthread |
|
private |
◆ nworking
◆ pflags
| std::atomic<bool>* madness::Barrier::pflags[MAX_NTHREAD] |
|
private |
◆ sense
| std::atomic<bool> madness::Barrier::sense |
|
private |
The documentation for this class was generated from the following file: