35 #ifndef NEKTAR_LIB_UTILITIES_THREAD_H_ 36 #define NEKTAR_LIB_UTILITIES_THREAD_H_ 41 #include <boost/thread/mutex.hpp> 42 #include <boost/thread/locks.hpp> 43 #include <boost/thread/condition_variable.hpp> 44 #include <boost/thread/thread.hpp> 308 return pPartition % GetMaxNumWorkers();
313 return pPartition / GetMaxNumWorkers();
318 return pRank * GetMaxNumWorkers() + pThr;
322 typedef boost::unique_lock<boost::shared_mutex>
WriteLock;
323 typedef boost::shared_lock<boost::shared_mutex>
ReadLock;
387 virtual void QueueJobs(std::vector<ThreadJob*>& joblist);
389 virtual unsigned int GetNumWorkers();
391 virtual void SetNumWorkers(
const unsigned int num);
392 virtual void SetNumWorkers();
393 virtual unsigned int GetMaxNumWorkers();
395 virtual void SetChunkSize(
unsigned int chnk);
397 virtual bool InThread();
399 virtual bool IsInitialised();
400 virtual const std::string& GetType()
const;
int GetThrFromPartition(int pPartition)
std::shared_ptr< ThreadManager > ThreadManagerSharedPtr
unsigned int GetWorkerNum()
void SetWorkerNum(unsigned int num)
Set number of worker threads.
SchedType
Identifies the algorithm for scheduling.
boost::shared_lock< boost::shared_mutex > ReadLock
int GetPartitionFromRankThr(int pRank, unsigned int pThr)
ThreadJob()
Base constructor.
ThreadManagerFactory & GetThreadManagerFactory()
boost::unique_lock< boost::shared_mutex > WriteLock
#define LIB_UTILITIES_EXPORT
std::vector< ThreadManagerSharedPtr > m_threadManagers
std::string m_threadingType
LibUtilities::NekFactory< std::string, ThreadManager, unsigned int > ThreadManagerFactory
int GetRankFromPartition(int pPartition)
ThreadMaster & GetThreadMaster()
boost::shared_mutex m_mutex
Base class for tasks to be sent to the ThreadManager to run.
virtual ~ThreadJob()
Base destructor.
The interface class for the controller for worker threads and jobs.
Provides a generic Factory class.