00001 //------------------------------------------------------------- 00002 // Go4 Release Package v3.04-01 (build 30401) 00003 // 28-November-2008 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at EE 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 "TNamed.h" 00020 00021 class TGo4Thread; 00022 class TIterator; 00023 class TObjArray; 00024 class TMutex; 00025 class TGo4ThreadManager; 00026 class TGo4Runnable; 00027 00043 class TGo4ThreadHandler : public TNamed { 00044 00045 public: 00046 TGo4ThreadHandler(const TGo4ThreadHandler &right); 00047 00048 TGo4ThreadHandler (const char* name, TGo4ThreadManager* parent); 00049 00050 virtual ~TGo4ThreadHandler(); 00051 00053 Bool_t AddThread (TGo4Thread* gthr); 00054 00056 Bool_t RemoveThread (const char* name); 00057 00060 Bool_t NewThread(const char* name, TGo4Runnable* runnable); 00061 00063 Int_t CreateAll(); 00064 00067 Bool_t Create(const char* thname); 00068 00070 Int_t CancelAll(); 00071 00074 Bool_t Cancel(const char* thname); 00075 00077 Int_t ReCreateAll(); 00078 00080 Bool_t ReCreate(const char* thname); 00081 00083 Int_t StartAll(); 00084 00087 Bool_t Start(const char* thname); 00088 00090 Int_t StopAll (); 00091 00095 Bool_t Stop(const char* thname); 00096 00099 Int_t DumpThreads(Int_t mode = 0); 00100 00102 TGo4Thread* GetThread(const char* name); 00103 00105 Int_t GetEntries(); 00106 00110 Bool_t AllCreated(); 00111 00114 Bool_t AllRunning(); 00115 00118 Bool_t AllWaiting(); 00119 00123 Bool_t IsOperating() const { return fbIsOperating; } 00124 00125 protected: 00126 00130 TGo4ThreadManager *fxManager; 00131 00132 private: 00133 00137 Bool_t fbIsOperating; 00138 00140 TMutex *fxListMutex; 00141 00143 TIterator *fxIterator; 00144 00146 TObjArray *fxArray; 00147 00154 TMutex *fxOperMutex; 00155 00156 TGo4ThreadHandler(); 00157 }; 00158 00159 #endif 00160 00161 //----------------------------END OF GO4 SOURCE FILE ---------------------