SUNphi  1.0
SUNphi::ThreadPool Class Reference

Dummy thread pool. More...

#include <Pool.hpp>

Public Member Functions

void assertPoolOnly (const int &threadId) const
 Assert that only the pool is accessing. More...
 
void assertMasterOnly (const int &threadId) const
 Assert that only the master thread is accessing. More...
 
int getThreadId () const
 Get the thread of the current thread.
 
void mutexLock ()
 Lock the internal mutex.
 
void mutexUnlock ()
 Unlock the mutex.
 
bool isMasterThread () const
 Compares the thread tag with the master one.
 
int nActiveThreads () const
 Gets the number of allocated threads.
 
bool getIfWaitingForWork () const
 Return whether the pool is waiting for work.
 
template<typename F >
void workOn (F f)
 
template<typename Size , typename F >
void loopSplit (const Size &beg, const Size &end, F f)
 Perform a loop. More...
 
 ThreadPool (int nThreads=1)
 Dummy constructor.
 

Detailed Description

Dummy thread pool.

Definition at line 465 of file Pool.hpp.

Member Function Documentation

void SUNphi::ThreadPool::assertMasterOnly ( const int &  threadId) const
inline

Assert that only the master thread is accessing.

Parameters
threadIdCalling thread

Definition at line 477 of file Pool.hpp.

void SUNphi::ThreadPool::assertPoolOnly ( const int &  threadId) const
inline

Assert that only the pool is accessing.

Parameters
threadIdCalling thread

Definition at line 471 of file Pool.hpp.

template<typename Size , typename F >
void SUNphi::ThreadPool::loopSplit ( const Size &  beg,
const Size &  end,
f 
)
inline

Perform a loop.

Parameters
begBeginning of the loop
endEnd of the loop
fFunction to be called, accepting two integers: the first is the thread id, which will always be 0, the second the loop argument

Definition at line 538 of file Pool.hpp.

template<typename F >
void SUNphi::ThreadPool::workOn ( f)
inline

Gives to all threads some work to be done

The object f must be callable, returning void and getting an integer as a parameter, representing the thread id

Parameters
fFunction embedding the work

Definition at line 530 of file Pool.hpp.


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