Nektar++
|
Implementation class for ThreadManagerBoost. More...
#include <ThreadBoost.h>
Public Member Functions | |
ThreadWorkerBoost (ThreadManagerBoost *threadManager, unsigned int workerNum) | |
Constructor. More... | |
~ThreadWorkerBoost () | |
Destructor. More... | |
void | operator() () |
This provides the interface that boost::thread uses to start the worker. More... | |
unsigned int | GetWorkerNum () |
Return the index of the worker thread. More... | |
void | Stop () |
A signal to shut down. More... | |
Private Member Functions | |
ThreadWorkerBoost () | |
ThreadWorkerBoost (const ThreadWorkerBoost &) | |
void | MainLoop () |
void | LoadJobs () |
unsigned int | GetNumToLoad () |
void | WaitForActive () |
void | RunJobs () |
Private Attributes | |
ThreadManagerBoost * | m_threadManager |
std::queue< ThreadJob * > | m_workerQueue |
bool | m_keepgoing |
unsigned int | m_threadNum |
Implementation class for ThreadManagerBoost.
Each instance of this class corresponds to a worker thread. Instances manage their own queue of jobs to run, grabbing new jobs from the master queue when it is exhausted.
Definition at line 127 of file ThreadBoost.h.
Nektar::Thread::ThreadWorkerBoost::ThreadWorkerBoost | ( | ThreadManagerBoost * | tm, |
unsigned int | workerNum | ||
) |
Constructor.
threadManager | Pointer to the ThreadManagerBoost that is controlling this worker. |
workerNum | Unique number from 0..(number_of_threads - 1) |
Called by the ThreadManagerBoost instance.
Definition at line 330 of file ThreadBoost.cpp.
Nektar::Thread::ThreadWorkerBoost::~ThreadWorkerBoost | ( | ) |
Destructor.
Winds up this thread's execution. Jobs in its queue are lost.
Definition at line 343 of file ThreadBoost.cpp.
References m_keepgoing, and m_threadNum.
|
private |
|
private |
|
private |
Definition at line 394 of file ThreadBoost.cpp.
References Nektar::Thread::e_dynamic, Nektar::Thread::e_guided, Nektar::Thread::ThreadManagerBoost::m_chunkSize, Nektar::Thread::ThreadManagerBoost::m_masterQueue, Nektar::Thread::ThreadManagerBoost::m_numWorkers, Nektar::Thread::ThreadManagerBoost::m_schedType, and m_threadManager.
Referenced by LoadJobs().
|
inline |
Return the index of the worker thread.
Definition at line 143 of file ThreadBoost.h.
References m_threadNum.
|
private |
Definition at line 358 of file ThreadBoost.cpp.
References GetNumToLoad(), m_keepgoing, Nektar::Thread::ThreadManagerBoost::m_masterActiveMutex, Nektar::Thread::ThreadManagerBoost::m_masterQueue, Nektar::Thread::ThreadManagerBoost::m_masterQueueCondVar, Nektar::Thread::ThreadManagerBoost::m_masterQueueMutex, Nektar::Thread::ThreadManagerBoost::m_threadActiveList, Nektar::Thread::ThreadManagerBoost::m_threadBusyList, m_threadManager, m_threadNum, and m_workerQueue.
Referenced by MainLoop().
|
private |
Definition at line 435 of file ThreadBoost.cpp.
References LoadJobs(), m_keepgoing, RunJobs(), and WaitForActive().
Referenced by operator()().
|
inline |
This provides the interface that boost::thread uses to start the worker.
Definition at line 137 of file ThreadBoost.h.
References MainLoop().
|
private |
Definition at line 449 of file ThreadBoost.cpp.
References m_keepgoing, m_threadNum, m_workerQueue, Nektar::Thread::ThreadJob::Run(), and Nektar::Thread::ThreadJob::SetWorkerNum().
Referenced by MainLoop().
|
inline |
A signal to shut down.
If this method is called the worker will shut down. Used by the ThreadManagerBoost to stop threading.
Definition at line 150 of file ThreadBoost.h.
References m_keepgoing.
Referenced by Nektar::Thread::ThreadManagerBoost::~ThreadManagerBoost().
|
private |
Definition at line 418 of file ThreadBoost.cpp.
References m_keepgoing, Nektar::Thread::ThreadManagerBoost::m_masterActiveCondVar, Nektar::Thread::ThreadManagerBoost::m_masterActiveMutex, Nektar::Thread::ThreadManagerBoost::m_threadActiveList, m_threadManager, and m_threadNum.
Referenced by MainLoop().
|
private |
Definition at line 164 of file ThreadBoost.h.
Referenced by LoadJobs(), MainLoop(), RunJobs(), Stop(), WaitForActive(), and ~ThreadWorkerBoost().
|
private |
Definition at line 162 of file ThreadBoost.h.
Referenced by GetNumToLoad(), LoadJobs(), and WaitForActive().
|
private |
Definition at line 165 of file ThreadBoost.h.
Referenced by GetWorkerNum(), LoadJobs(), RunJobs(), WaitForActive(), and ~ThreadWorkerBoost().
|
private |
Definition at line 163 of file ThreadBoost.h.
Referenced by LoadJobs(), and RunJobs().