GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
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
19class TGo4Thread;
20class TIterator;
21class TObjArray;
22class TMutex;
24class TGo4Runnable;
25
41
42class TGo4ThreadHandler : public TNamed {
43
44 public:
46
47 TGo4ThreadHandler (const char *name, TGo4ThreadManager *parent);
48
49 virtual ~TGo4ThreadHandler();
50
52 Bool_t AddThread (TGo4Thread *gthr);
53
55 Bool_t RemoveThread (const char *name);
56
59 Bool_t NewThread(const char *name, TGo4Runnable *runnable);
60
62 Int_t CreateAll();
63
66 Bool_t Create(const char *thname);
67
69 Int_t CancelAll();
70
73 Bool_t Cancel(const char *thname);
74
76 Int_t ReCreateAll();
77
79 Bool_t ReCreate(const char *thname);
80
82 Int_t StartAll();
83
86 Bool_t Start(const char *thname);
87
89 Int_t StopAll ();
90
94 Bool_t Stop(const char *thname);
95
98 Int_t DumpThreads(Int_t mode = 0);
99
101 TGo4Thread *GetThread(const char *name);
102
104 Int_t GetEntries() const;
105
109 Bool_t AllCreated();
110
113 Bool_t AllRunning();
114
117 Bool_t AllWaiting();
118
122 Bool_t IsOperating() const { return fbIsOperating; }
123
124 protected:
125
130
131 private:
132
136 Bool_t fbIsOperating{kFALSE};
137
139 TMutex *fxListMutex{nullptr};
140
142 TIterator *fxIterator{nullptr};
143
145 TObjArray *fxArray{nullptr};
146
153 TMutex *fxOperMutex{nullptr};
154
156};
157
158#endif
Base class for all go4 runnables.
TGo4Thread * GetThread(const char *name)
Access to Go4Thread by name.
Int_t DumpThreads(Int_t mode=0)
dumps thread process information to logging output i.e.
TMutex * fxListMutex
Mutex protecting thread array.
Bool_t AllCreated()
Returns true if all root threads in list are existing, i.e.
TGo4ThreadManager * fxManager
Backlink to threadmanager who owns this thread handler.
Int_t CancelAll()
Cancel all Threads in the thread list.
Int_t GetEntries() const
Number of threads in list.
Bool_t fbIsOperating
kTRUE, if threadhandler performs any action that requires gSystem support.
Bool_t RemoveThread(const char *name)
Remove thread by name from Thread List.
Int_t StopAll()
Start work function of all Threads in the thread list.
TIterator * fxIterator
Iterator for Thread Array.
Bool_t NewThread(const char *name, TGo4Runnable *runnable)
Creates new internal Go4 Thread with name and adds it to the List External runnable is passed to spec...
TGo4ThreadHandler(const TGo4ThreadHandler &right)
Bool_t AllWaiting()
Returns true if all threads in list are waiting, i.e.
Int_t ReCreateAll()
Recreate all Threads in the thread list.
Bool_t Start(const char *thname)
Starts work function of the Go4 Thread of name 'name'.
Bool_t IsOperating() const
Returns kTRUE if threadhandler performs any action that requires gSystem support.
Int_t CreateAll()
Launch all Threads in the thread list.
Int_t StartAll()
Start work function of all Threads in the thread list.
TMutex * fxOperMutex
Mutex to protect IsOperating flag, flag is set kTRUE to indicate that AppControl timer must not block...
Bool_t AddThread(TGo4Thread *gthr)
Adds Reference to (externally created) thread to Thread List.
Bool_t AllRunning()
Returns true if all threads in list are running, i.e.
Bool_t Create(const char *thname)
Launch the ROOT Thread specified by the Go4 Thread of name 'name'.
Bool_t Stop(const char *thname)
Stops work function of the Go4 Thread of name 'name'.
TObjArray * fxArray
Array of Go4Threads.
Bool_t Cancel(const char *thname)
Cancels the ROOT Thread specified by the Go4 Thread of name 'name'.
Bool_t ReCreate(const char *thname)
ReCreate (Cancel and Create) all Threads in the thread list.
Go4 thread manager.
go4 thread class
Definition TGo4Thread.h:34