MADNESS
0.10.1
|
#include <worldmutex.h>
Public Member Functions | |
Barrier (int nthread) | |
bool | enter (const int id) |
Each thread calls this with its id (0,..,nthread-1) to enter the barrier. More... | |
void | register_thread (int id, volatile bool *pflag) |
Each thread calls this once before first use. More... | |
Private Attributes | |
const int | nthread |
AtomicInt | nworking |
volatile bool * | pflags [128] |
volatile bool | sense |
|
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, nthread, nworking, pflags, and sense.
Referenced by madness::TaskThreadEnv::barrier().
|
inline |
Each thread calls this once before first use.
id should be the thread id (0,..,nthread-1) and pflag a pointer to thread-local bool (probably in the thread's stack)
References MADNESS_EXCEPTION, pflags, and sense.
|
private |
Referenced by enter(), and register_thread().
|
private |
Referenced by enter(), and register_thread().