00001 //--------------------------------------------------------------- 00002 // Go4 Release Package v2.10-5 (build 21005) 00003 // 03-Nov-2005 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at DVEE department, GSI 00007 //--------------------------------------------------------------- 00008 // 00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI 00010 // Planckstr. 1, 64291 Darmstadt, Germany 00011 //Contact: http://go4.gsi.de 00012 //---------------------------------------------------------------- 00013 //This software can be used under the license agreements as stated 00014 //in Go4License.txt file which is part of the distribution. 00015 //---------------------------------------------------------------- 00016 #ifndef TGo4ThreadHandler_H 00017 #define TGo4ThreadHandler_H 00018 00019 #include "TGo4Thread.h" 00020 #include "TIterator.h" 00021 #include "TObjArray.h" 00022 #include "TNamed.h" 00023 #include "TMutex.h" 00024 00025 class TGo4ThreadManager; 00026 class TGo4Runnable; 00027 00048 class TGo4ThreadHandler : public TNamed { 00049 00050 public: 00051 TGo4ThreadHandler(const TGo4ThreadHandler &right); 00052 00053 TGo4ThreadHandler (const char* name, TGo4ThreadManager* parent); 00054 00055 virtual ~TGo4ThreadHandler(); 00056 00061 Bool_t AddThread (TGo4Thread* gthr); 00062 00067 Bool_t RemoveThread (const char* name); 00068 00073 Bool_t NewThread (const char* name, TGo4Runnable* runnable); 00074 00078 Int_t CreateAll (); 00079 00084 Bool_t Create (const char* thname); 00085 00089 Int_t CancelAll (); 00090 00095 Bool_t Cancel (const char* thname); 00096 00100 Int_t ReCreateAll (); 00101 00105 Bool_t ReCreate (const char* thname); 00106 00110 Int_t StartAll (); 00111 00116 Bool_t Start (const char* thname); 00117 00121 Int_t StopAll (); 00122 00128 Bool_t Stop (const char* thname); 00129 00134 Int_t DumpThreads (Int_t mode = 0); 00135 00136 00140 TGo4Thread* GetThread (const char* name); 00141 00145 Int_t GetEntries (); 00146 00152 Bool_t AllCreated (); 00153 00154 00159 Bool_t AllRunning (); 00160 00161 //## Operation: AllWaiting%395B6CFE01A6 00162 00167 Bool_t AllWaiting (); 00168 00169 00175 Bool_t IsOperating () const { return fbIsOperating; } 00176 00177 00178 protected: 00179 00185 TGo4ThreadManager *fxManager; 00186 00187 private: 00188 00194 Bool_t fbIsOperating; 00195 00199 TMutex *fxListMutex; 00200 00204 TIterator *fxIterator; 00205 00209 TObjArray *fxArray; 00210 00219 TMutex *fxOperMutex; 00220 00221 TGo4ThreadHandler(); 00222 }; 00223 00224 #endif 00225 00226 //----------------------------END OF GO4 SOURCE FILE ---------------------