00001 // $Id: TGo4ThreadManager.h 1196 2014-04-10 14:06:24Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #ifndef TGo4ThreadManager_H 00015 #define TGo4ThreadManager_H 00016 00017 #include "TNamed.h" 00018 00019 class TGo4ThreadHandler; 00020 class TGo4AppControlTimer; 00021 00030 class TGo4ThreadManager : public TNamed { 00031 00032 public: 00033 TGo4ThreadManager(const TGo4ThreadManager &right); 00034 00039 TGo4ThreadManager (const char* name, Bool_t blockingmode = kTRUE, Bool_t autostart = kTRUE, Bool_t autocreate = kTRUE); 00040 00041 virtual ~TGo4ThreadManager(); 00042 00045 void SetTimer(TGo4AppControlTimer* ctrltimer) { fxBlocker=ctrltimer; } 00046 00048 TGo4ThreadHandler* GetWorkHandler() const { return fxWorkHandler; } 00049 00051 Bool_t BlockApp(); 00052 00059 Bool_t UnBlockApp(Int_t mode = 0); 00060 00061 virtual Int_t Initialization(); 00062 00063 Bool_t IsInitDone() const { return fbInitDone; } 00064 00066 Bool_t IsTerminating () const { return fbTerminating; } 00067 00068 Bool_t IsTerminateApp() const { return fbTerminateApplication; } 00069 00071 Bool_t IsAppBlocking() const { return fbAppBlocking; } 00072 00073 00075 Bool_t IsBeingQuit() const { return fbBeingQuit; } 00076 00077 void SetBeingQuit(Bool_t on) {fbBeingQuit=on;} 00078 00079 00085 void Launch (); 00086 00090 virtual void Terminate (Bool_t termapp=kTRUE); 00091 00093 virtual void TerminateFast(); 00094 00096 static const Long_t fglTIMERPERIOD; 00097 00099 enum { fguTEXTLENGTH = 256 }; 00100 00101 protected: 00102 00104 Bool_t fbInitDone; 00105 00107 Bool_t fbTerminating; 00108 00111 Bool_t fbTerminateApplication; 00112 00116 Bool_t fbAppBlocking; 00117 00120 Bool_t fbAutoCreate; 00121 00125 Bool_t fbAutoStart; 00126 00127 /* flag that can be set at begin of application quit sequence. 00128 * Can be optionally used by application to implement a quit timeout 00129 * that will terminate if regular shutdown hangs up*/ 00130 Int_t fbBeingQuit; 00131 00136 TGo4AppControlTimer *fxBlocker; 00137 00142 TGo4ThreadHandler *fxWorkHandler; 00143 00144 private: 00145 TGo4ThreadManager(); 00146 00147 ClassDef(TGo4ThreadManager,1) 00148 }; 00149 00150 #endif