ToolDAQFramework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
MyToolDynamicMultiThread Class Reference

#include <MyToolDynamicMultiThread.h>

Inheritance diagram for MyToolDynamicMultiThread:

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...
 
Utilitiesm_util
 Pointer to utilities class to help with threading. More...
 

Detailed Description

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.

Author:
B.Richards
Date:
2019/05/28 10:44:00

Contact: b.ric.nosp@m.hard.nosp@m.s@qmu.nosp@m.l.ac.nosp@m..uk

Definition at line 38 of file MyToolDynamicMultiThread.h.

Constructor & Destructor Documentation

MyToolDynamicMultiThread::MyToolDynamicMultiThread ( )

Simple constructor.

Definition at line 8 of file MyToolDynamicMultiThread.cpp.

Member Function Documentation

void MyToolDynamicMultiThread::CreateThread ( )
private

Function to Create Thread.

Definition at line 78 of file MyToolDynamicMultiThread.cpp.

void MyToolDynamicMultiThread::DeleteThread ( int  pos)
private

Function to delete thread.

Parameters
posis 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.

Parameters
configfileThe path and name of the dynamic configuration file to read in.
dataA reference to the transient data class used to pass information between Tools.

Definition at line 11 of file MyToolDynamicMultiThread.cpp.

void MyToolDynamicMultiThread::Thread ( Thread_args arg)
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.

Member Data Documentation

std::vector<MyToolDynamicMultiThread_args*> MyToolDynamicMultiThread::args
private

Vector of thread args (also holds pointers to the threads)

Definition at line 56 of file MyToolDynamicMultiThread.h.

int MyToolDynamicMultiThread::m_freethreads
private

Keeps track of free threads.

Definition at line 58 of file MyToolDynamicMultiThread.h.

unsigned long MyToolDynamicMultiThread::m_threadnum
private

Counter for unique naming of threads.

Definition at line 59 of file MyToolDynamicMultiThread.h.

Utilities* MyToolDynamicMultiThread::m_util
private

Pointer to utilities class to help with threading.

Definition at line 55 of file MyToolDynamicMultiThread.h.


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