ToolDAQFramework
|
#include <MyToolDynamicMultiThread.h>
Public Member Functions | |
MyToolDynamicMultiThread () | |
Simple constructor. More... | |
bool | Execute () |
Executre function used to perform Tool perpose. More... | |
bool | Finalise () |
Finalise funciton used to clean up resorces. More... | |
bool | Initialise (std::string configfile, DataModel &data) |
Initialise Function for setting up Tool resorces. More... | |
Private Member Functions | |
void | CreateThread () |
Function to Create Thread. More... | |
void | DeleteThread (int pos) |
Function to delete thread. More... | |
Static Private Member Functions | |
static void | Thread (Thread_args *arg) |
Function to be run by the thread in a loop. Make sure not to block in it. More... | |
Private Attributes | |
std::vector < MyToolDynamicMultiThread_args * > | args |
Vector of thread args (also holds pointers to the threads) More... | |
int | m_freethreads |
Keeps track of free threads. More... | |
unsigned long | m_threadnum |
Counter for unique naming of threads. More... | |
Utilities * | m_util |
Pointer to utilities class to help with threading. More... | |
This is a template for a Tool that dynamically more or less threads, such that there is always 1 available thread.This can therefore be used to scale to your worklaod, however be carefull when using more than one of these tools and to apply upperlimits if necessary both locally within this tool and globally so that more threads than is practical are created causing massive inefficency. Please fill out the descripton and author information.
Contact: b.ric hard s@qmu l.ac .uk
Definition at line 38 of file MyToolDynamicMultiThread.h.
MyToolDynamicMultiThread::MyToolDynamicMultiThread | ( | ) |
Simple constructor.
Definition at line 8 of file MyToolDynamicMultiThread.cpp.
|
private |
Function to Create Thread.
Definition at line 78 of file MyToolDynamicMultiThread.cpp.
|
private |
Function to delete thread.
pos | is the position in the args vector below |
Definition at line 91 of file MyToolDynamicMultiThread.cpp.
bool MyToolDynamicMultiThread::Execute | ( | ) |
Executre function used to perform Tool perpose.
Definition at line 34 of file MyToolDynamicMultiThread.cpp.
bool MyToolDynamicMultiThread::Finalise | ( | ) |
Finalise funciton used to clean up resorces.
Definition at line 66 of file MyToolDynamicMultiThread.cpp.
bool MyToolDynamicMultiThread::Initialise | ( | std::string | configfile, |
DataModel & | data | ||
) |
Initialise Function for setting up Tool resorces.
configfile | The path and name of the dynamic configuration file to read in. |
data | A reference to the transient data class used to pass information between Tools. |
Definition at line 11 of file MyToolDynamicMultiThread.cpp.
|
staticprivate |
Function to be run by the thread in a loop. Make sure not to block in it.
Definition at line 100 of file MyToolDynamicMultiThread.cpp.
|
private |
Vector of thread args (also holds pointers to the threads)
Definition at line 56 of file MyToolDynamicMultiThread.h.
|
private |
Keeps track of free threads.
Definition at line 58 of file MyToolDynamicMultiThread.h.
|
private |
Counter for unique naming of threads.
Definition at line 59 of file MyToolDynamicMultiThread.h.
|
private |
Pointer to utilities class to help with threading.
Definition at line 55 of file MyToolDynamicMultiThread.h.