ToolDAQFramework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
MyToolDynamicMultiThread.h
Go to the documentation of this file.
1 #ifndef MYTOOLDynamicMultiThread_H
2 #define MYTOOLDynamicMultiThread_H
3 
4 #include <string>
5 #include <iostream>
6 
7 #include "Tool.h"
8 
21 
24  bool busy;
25  std::string message;
26 
27 };
28 
38 class MyToolDynamicMultiThread: public Tool {
39 
40 
41  public:
42 
44  bool Initialise(std::string configfile,DataModel &data);
45  bool Execute();
46  bool Finalise();
47 
48 
49  private:
50 
51  void CreateThread();
52  void DeleteThread(int pos);
53 
54  static void Thread(Thread_args* arg);
56  std::vector<MyToolDynamicMultiThread_args*> args;
57 
59  unsigned long m_threadnum;
60 
61 };
62 
63 
64 #endif
bool Execute()
Executre function used to perform Tool perpose.
unsigned long m_threadnum
Counter for unique naming of threads.
void CreateThread()
Function to Create Thread.
bool Finalise()
Finalise funciton used to clean up resorces.
void DeleteThread(int pos)
Function to delete thread.
Utilities * m_util
Pointer to utilities class to help with threading.
MyToolDynamicMultiThread()
Simple constructor.
static void Thread(Thread_args *arg)
Function to be run by the thread in a loop. Make sure not to block in it.
int m_freethreads
Keeps track of free threads.
bool Initialise(std::string configfile, DataModel &data)
Initialise Function for setting up Tool resorces.
std::vector< MyToolDynamicMultiThread_args * > args
Vector of thread args (also holds pointers to the threads)