xmsinterp  1.0
xms::ThreadMgrImpl Class Reference

Implmentation of ThreadMgr. More...

Inheritance diagram for xms::ThreadMgrImpl:
xms::ThreadMgr

Classes

struct  myThread
 convenience struct for threads More...
 

Public Member Functions

 ThreadMgrImpl ()
 Constructor.
 
void SetThreadLoopClass (BSHP< ThreadLoop > a_) override
 
void ExplicitlySetNumThreads (int a_nThreads) override
 
void RunThreads (int a_nIter) override
 Executes the threads. More...
 
void SetObserver (BSHP< Observer > a_prog) override
 
std::vector< BSHP< ThreadLoop > > Threads () override
 Gets the threads managed by this class. More...
 
void SetupThreads ()
 Sets up the threads.
 
void MonitorThreads ()
 Monitors the progress of all the threads.
 
void FinishThreads ()
 When all iterations are complete this terminates the threads.
 

Public Attributes

BSHP< ThreadLoopm_threader
 the worker class that is duplicated to run in multiple threads
 
BSHP< Observerm_prog
 observes the threads and gives feedback of % complete
 
int m_nThread
 number of threads running
 
int m_nIter
 total number of iterations for all threads combined
 
VecInt m_beg
 starting index for each thread
 
VecInt m_thrdNumIter
 number of iterations for each thread
 
VecInt m_counts
 number of completed iterations for each thread
 
std::vector< myThreadm_vMyThread
 vector of created threads
 
std::vector< boost::thread > m_vThreads
 actual boost threads that are run
 

Additional Inherited Members

- Static Public Member Functions inherited from xms::ThreadMgr
static BSHP< ThreadMgrNew ()
 Creates a ThreadMgr. More...
 
- Protected Member Functions inherited from xms::ThreadMgr
 ThreadMgr ()
 constructor
 

Detailed Description

Implmentation of ThreadMgr.

Class to manage multiple threads using boost.

Definition at line 38 of file ThreadMgr.cpp.

Member Function Documentation

◆ ExplicitlySetNumThreads()

void xms::ThreadMgrImpl::ExplicitlySetNumThreads ( int  a_nThreads)
inlineoverridevirtual
Parameters
a_nThreadsnumber of threads.

Implements xms::ThreadMgr.

Definition at line 66 of file ThreadMgr.cpp.

References m_nThread.

◆ RunThreads()

void xms::ThreadMgrImpl::RunThreads ( int  a_nIter)
overridevirtual

Executes the threads.

Parameters
[in]a_nIterTotal number of iterations for the threads to execute.

Implements xms::ThreadMgr.

Definition at line 139 of file ThreadMgr.cpp.

References FinishThreads(), m_nIter, m_nThread, MonitorThreads(), and SetupThreads().

◆ SetObserver()

void xms::ThreadMgrImpl::SetObserver ( BSHP< Observer a_prog)
inlineoverridevirtual
Parameters
a_progAn observer

Implements xms::ThreadMgr.

Definition at line 69 of file ThreadMgr.cpp.

References m_prog.

◆ SetThreadLoopClass()

void xms::ThreadMgrImpl::SetThreadLoopClass ( BSHP< ThreadLoop a_)
inlineoverridevirtual
Parameters
a_ThreadLoop.

Implements xms::ThreadMgr.

Definition at line 64 of file ThreadMgr.cpp.

References m_threader.

◆ Threads()

std::vector< BSHP< ThreadLoop > > xms::ThreadMgrImpl::Threads ( )
overridevirtual

Gets the threads managed by this class.

Returns
A Vector of threads managed by this class

Implements xms::ThreadMgr.

Definition at line 126 of file ThreadMgr.cpp.

References m_vMyThread.


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