35#ifndef NEKTAR_LIBUTILITIES_THREADSTD_H_
36#define NEKTAR_LIBUTILITIES_THREADSTD_H_
38#include <condition_variable>
50typedef std::unique_lock<std::mutex>
Lock;
70 std::unique_lock<std::mutex> lLock{
mMutex};
110 void v_QueueJobs(std::vector<ThreadJob *> &joblist)
override;
122 const std::string &
v_GetType()
const override;
Base class for tasks to be sent to the ThreadManager to run.
The interface class for the controller for worker threads and jobs.
Lightweight barrier class.
Barrier(std::size_t iCount)
std::condition_variable mCond
Implementation of ThreadManager using std::thread.
void v_SetSchedType(SchedType s) override
~ThreadManagerStd() override
Shuts down threading.
const std::string & v_GetType() const override
unsigned int m_numWorkers
bool * m_threadActiveList
std::map< std::thread::id, unsigned int > m_threadMap
void v_QueueJob(ThreadJob *job) override
ThreadWorkerStd ** m_threadList
void v_QueueJobs(std::vector< ThreadJob * > &joblist) override
static ThreadManagerSharedPtr Create(unsigned int numT)
Called by the factory method.
bool v_InThread() override
std::thread ** m_threadThreadList
std::mutex m_masterActiveMutex
std::mutex m_masterQueueMutex
std::thread::id m_masterThreadId
unsigned int v_GetNumWorkers() override
ThreadManagerStd(const ThreadManagerStd &)
const unsigned int m_numThreads
void v_SetNumWorkers() override
std::queue< ThreadJob * > m_masterQueue
std::condition_variable m_masterQueueCondVar
std::condition_variable m_masterActiveCondVar
void SetNumWorkersImpl(const unsigned int num)
unsigned int v_GetMaxNumWorkers() override
void v_SetChunkSize(unsigned int chnk) override
unsigned int v_GetWorkerNum() override
static std::string className
Implementation class for ThreadManagerStd.
std::queue< ThreadJob * > m_workerQueue
ThreadManagerStd * m_threadManager
~ThreadWorkerStd()
Destructor.
void Stop()
A signal to shut down.
unsigned int GetWorkerNum()
Return the index of the worker thread.
void operator()()
This provides the interface that std::thread uses to start the worker.
ThreadWorkerStd(const ThreadWorkerStd &)
unsigned int GetNumToLoad()
std::unique_lock< std::mutex > Lock
SchedType
Identifies the algorithm for scheduling.
std::shared_ptr< ThreadManager > ThreadManagerSharedPtr