GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4ThreadHandler.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 TGo4ThreadHandler_H
15 #define TGo4ThreadHandler_H
16 
17 #include "TNamed.h"
18 
19 class TGo4Thread;
20 class TIterator;
21 class TObjArray;
22 class TMutex;
23 class TGo4ThreadManager;
24 class TGo4Runnable;
25 
40 class TGo4ThreadHandler : public TNamed {
41 
42  public:
44 
45  TGo4ThreadHandler (const char *name, TGo4ThreadManager *parent);
46 
47  virtual ~TGo4ThreadHandler();
48 
50  Bool_t AddThread (TGo4Thread *gthr);
51 
53  Bool_t RemoveThread (const char *name);
54 
57  Bool_t NewThread(const char *name, TGo4Runnable *runnable);
58 
60  Int_t CreateAll();
61 
64  Bool_t Create(const char *thname);
65 
67  Int_t CancelAll();
68 
71  Bool_t Cancel(const char *thname);
72 
74  Int_t ReCreateAll();
75 
77  Bool_t ReCreate(const char *thname);
78 
80  Int_t StartAll();
81 
84  Bool_t Start(const char *thname);
85 
87  Int_t StopAll ();
88 
92  Bool_t Stop(const char *thname);
93 
96  Int_t DumpThreads(Int_t mode = 0);
97 
99  TGo4Thread *GetThread(const char *name);
100 
102  Int_t GetEntries() const;
103 
107  Bool_t AllCreated();
108 
111  Bool_t AllRunning();
112 
115  Bool_t AllWaiting();
116 
120  Bool_t IsOperating() const { return fbIsOperating; }
121 
122  protected:
123 
128 
129  private:
130 
134  Bool_t fbIsOperating{kFALSE};
135 
137  TMutex *fxListMutex{nullptr};
138 
140  TIterator *fxIterator{nullptr};
141 
143  TObjArray *fxArray{nullptr};
144 
151  TMutex *fxOperMutex{nullptr};
152 
154 };
155 
156 #endif
TGo4Thread * GetThread(const char *name)
TGo4ThreadManager * fxManager
Int_t GetEntries() const
Bool_t ReCreate(const char *thname)
Bool_t NewThread(const char *name, TGo4Runnable *runnable)
Int_t DumpThreads(Int_t mode=0)
Bool_t Create(const char *thname)
Bool_t Stop(const char *thname)
Bool_t Start(const char *thname)
Bool_t Cancel(const char *thname)
Bool_t AddThread(TGo4Thread *gthr)
Bool_t IsOperating() const
Bool_t RemoveThread(const char *name)