00001 // $Id: TGo4ThreadManager.h 615 2010-04-14 15:34:12Z adamczew $ 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 00031 class TGo4ThreadManager : public TNamed { 00032 00033 public: 00034 TGo4ThreadManager(const TGo4ThreadManager &right); 00035 00040 TGo4ThreadManager (const char* name, Bool_t blockingmode = kTRUE, Bool_t autostart = kTRUE, Bool_t autocreate = kTRUE); 00041 00042 virtual ~TGo4ThreadManager(); 00043 00046 void SetTimer(TGo4AppControlTimer* ctrltimer) { fxBlocker=ctrltimer; } 00047 00049 TGo4ThreadHandler* GetWorkHandler() const { return fxWorkHandler; } 00050 00052 Bool_t BlockApp(); 00053 00060 Bool_t UnBlockApp(Int_t mode = 0); 00061 00062 virtual Int_t Initialization(); 00063 00064 Bool_t IsInitDone() const { return fbInitDone; } 00065 00067 Bool_t IsTerminating () const { return fbTerminating; } 00068 00069 Bool_t IsTerminateApp() const { return fbTerminateApplication; } 00070 00072 Bool_t IsAppBlocking() const { return fbAppBlocking; } 00073 00074 00076 Bool_t IsBeingQuit() const { return fbBeingQuit; } 00077 00078 void SetBeingQuit(Bool_t on) {fbBeingQuit=on;} 00079 00080 00086 void Launch (); 00087 00091 virtual void Terminate (Bool_t termapp=kTRUE); 00092 00094 virtual void TerminateFast(); 00095 00097 static const Long_t fglTIMERPERIOD; 00098 00100 enum { fguTEXTLENGTH = 256 }; 00101 00102 protected: 00103 00105 Bool_t fbInitDone; 00106 00108 Bool_t fbTerminating; 00109 00112 Bool_t fbTerminateApplication; 00113 00117 Bool_t fbAppBlocking; 00118 00121 Bool_t fbAutoCreate; 00122 00126 Bool_t fbAutoStart; 00127 00128 /* flag that can be set at begin of application quit sequence. 00129 * Can be optionally used by application to implement a quit timeout 00130 * that will terminate if regular shutdown hangs up*/ 00131 Int_t fbBeingQuit; 00132 00137 TGo4AppControlTimer *fxBlocker; 00138 00143 TGo4ThreadHandler *fxWorkHandler; 00144 00145 private: 00146 TGo4ThreadManager(); 00147 00148 ClassDef(TGo4ThreadManager,1) 00149 }; 00150 00151 #endif