GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
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 
19 class TGo4ThreadHandler;
21 
30 class TGo4ThreadManager : public TNamed {
31 
32  public:
34 
39  TGo4ThreadManager (const char *name, Bool_t blockingmode = kTRUE, Bool_t autostart = kTRUE, Bool_t autocreate = kTRUE);
40 
41  virtual ~TGo4ThreadManager();
42 
45  void SetTimer(TGo4AppControlTimer* ctrltimer) { fxBlocker=ctrltimer; }
46 
49 
51  Bool_t BlockApp();
52 
59  Bool_t UnBlockApp(Int_t mode = 0);
60 
61  virtual Int_t Initialization();
62 
63  Bool_t IsInitDone() const { return fbInitDone; }
64 
66  Bool_t IsTerminating() const { return fbTerminating; }
67 
68  Bool_t IsTerminateApp() const { return fbTerminateApplication; }
69 
71  Bool_t IsAppBlocking() const { return fbAppBlocking; }
72 
74  Bool_t IsBeingQuit() const { return fbBeingQuit; }
75 
76  void SetBeingQuit(Bool_t on) { fbBeingQuit = on; }
77 
83  void Launch();
84 
88  virtual void Terminate (Bool_t termapp=kTRUE);
89 
91  virtual void TerminateFast();
92 
94  static const Long_t fglTIMERPERIOD;
95 
97  enum { fguTEXTLENGTH = 256 };
98 
99  protected:
100 
102  Bool_t fbInitDone{kFALSE};
103 
105  Bool_t fbTerminating{kFALSE};
106 
109  Bool_t fbTerminateApplication{kFALSE};
110 
114  Bool_t fbAppBlocking{kFALSE};
115 
118  Bool_t fbAutoCreate{kFALSE};
119 
123  Bool_t fbAutoStart{kFALSE};
124 
125  /* flag that can be set at begin of application quit sequence.
126  * Can be optionally used by application to implement a quit timeout
127  * that will terminate if regular shutdown hangs up*/
128  Int_t fbBeingQuit{0};
129 
135 
141 
142  private:
144 
145  ClassDefOverride(TGo4ThreadManager,1)
146 };
147 
148 #endif
virtual Int_t Initialization()
virtual void TerminateFast()
Bool_t IsAppBlocking() const
TGo4ThreadHandler * fxWorkHandler
TGo4AppControlTimer * fxBlocker
Bool_t UnBlockApp(Int_t mode=0)
void SetTimer(TGo4AppControlTimer *ctrltimer)
Bool_t IsInitDone() const
TGo4ThreadHandler * GetWorkHandler() const
void SetBeingQuit(Bool_t on)
Bool_t IsTerminating() const
Bool_t IsBeingQuit() const
Bool_t IsTerminateApp() const
virtual void Terminate(Bool_t termapp=kTRUE)
static const Long_t fglTIMERPERIOD