GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4ThreadManager.h
Go to the documentation of this file.
1// $Id$
2//-----------------------------------------------------------------------
3// The GSI Online Offline Object Oriented (Go4) Project
4// Experiment Data Processing at EE department, GSI
5//-----------------------------------------------------------------------
6// Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7// Planckstr. 1, 64291 Darmstadt, Germany
8// Contact: http://go4.gsi.de
9//-----------------------------------------------------------------------
10// This software can be used under the license agreements as stated
11// in Go4License.txt file which is part of the distribution.
12//-----------------------------------------------------------------------
13
14#ifndef TGo4ThreadManager_H
15#define TGo4ThreadManager_H
16
17#include "TNamed.h"
18
21
31
32class TGo4ThreadManager : public TNamed {
33
34 public:
36
42 TGo4ThreadManager(const char *name, Bool_t blockingmode = kTRUE, Bool_t autostart = kTRUE, Bool_t autocreate = kTRUE);
43
44 virtual ~TGo4ThreadManager();
45
48 void SetTimer(TGo4AppControlTimer* ctrltimer) { fxBlocker=ctrltimer; }
49
52
54 Bool_t BlockApp();
55
62 Bool_t UnBlockApp(Int_t mode = 0);
63
64 virtual Int_t Initialization();
65
66 Bool_t IsInitDone() const { return fbInitDone; }
67
69 Bool_t IsTerminating() const { return fbTerminating; }
70
71 Bool_t IsTerminateApp() const { return fbTerminateApplication; }
72
74 Bool_t IsAppBlocking() const { return fbAppBlocking; }
75
77 Bool_t IsBeingQuit() const { return fbBeingQuit; }
78
79 void SetBeingQuit(Bool_t on) { fbBeingQuit = on; }
80
86 void Launch();
87
90 virtual void Terminate (Bool_t termap = kTRUE);
91
93 virtual void TerminateFast();
94
96 static const Long_t fglTIMERPERIOD;
97
99 enum { fguTEXTLENGTH = 256 };
100
101 protected:
102
104 Bool_t fbInitDone{kFALSE};
105
107 Bool_t fbTerminating{kFALSE};
108
112
116 Bool_t fbAppBlocking{kFALSE};
117
120 Bool_t fbAutoCreate{kFALSE};
121
125 Bool_t fbAutoStart{kFALSE};
126
127 /* flag that can be set at begin of application quit sequence.
128 * Can be optionally used by application to implement a quit timeout
129 * that will terminate if regular shutdown hangs up*/
130 Int_t fbBeingQuit{0};
131
137
143
144 private:
146
147 ClassDefOverride(TGo4ThreadManager,1)
148};
149
150#endif
Timer with main purpose to block the root TApplication loop during thread execution.
Go4 thread handler.
Bool_t IsTerminateApp() const
TGo4ThreadHandler * fxWorkHandler
Thread handler aggregate (threadsafe list of go4 threads) aggregationByValue 1 1.
Bool_t UnBlockApp(Int_t mode=0)
Wakes up the control timer waiting for his condition; parameter mode specifies whether timer will blo...
Bool_t fbAutoStart
If true, workfunctions (runnable Run()) of all go4threads in list shall be started automatically on I...
virtual void TerminateFast()
Alternative termination in case of error.
Bool_t fbTerminating
flag showing termination status
Bool_t IsTerminating() const
returns termination status of Threadmanager
Bool_t fbInitDone
is set kTRUE after first Initialize is done
TGo4AppControlTimer * fxBlocker
Composition of Application control timer.
virtual Int_t Initialization()
Bool_t IsAppBlocking() const
Returns true if threadmanager works in root system blocking mode.
static const Long_t fglTIMERPERIOD
Period in ms for the application control timer.
TGo4ThreadHandler * GetWorkHandler() const
Access to ThreadHandler for working threads.
Bool_t fbAutoCreate
If true, TThreads of all go4threads in list shall be created automatically on calling Launch().
Bool_t BlockApp()
Blocks gSystem by means of the blocking timer.
Bool_t fbAppBlocking
true if threadmanager shall block root gSystem using the AppControlTimer; false if gSystem shall neve...
void SetTimer(TGo4AppControlTimer *ctrltimer)
user can exchange the standard control timer by an own derived one by this method
TGo4ThreadManager(const TGo4ThreadManager &right)
void SetBeingQuit(Bool_t on)
Bool_t fbTerminateApplication
If true, terminate complete application.
Bool_t IsBeingQuit() const
Returns true if threadmanager works in root system blocking mode.
virtual void Terminate(Bool_t termap=kTRUE)
deletes the Manager instance via Control timer.
Bool_t IsInitDone() const
void Launch()
This Method has to be called to create the startup threads and to turn on the application control tim...