MADNESS  version 0.9
Public Member Functions | List of all members
madness::Barrier Class Reference

#include <worldmutex.h>

Public Member Functions

 Barrier (int nthread)
 
void register_thread (int id, volatile bool *pflag)
 Each thread calls this once before first use. More...
 
bool enter (const int id)
 Each thread calls this with its id (0,..,nthread-1) to enter the barrier. More...
 

Constructor & Destructor Documentation

madness::Barrier::Barrier ( int  nthread)
inline

Member Function Documentation

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(), and MADNESS_EXCEPTION.

Referenced by madness::TaskThreadEnv::barrier().

void madness::Barrier::register_thread ( int  id,
volatile 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 thread-local bool (probably in the thread's stack)

References MADNESS_EXCEPTION.


The documentation for this class was generated from the following file: