GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4Thread.h
Go to the documentation of this file.
1 // $Id: TGo4Thread.h 1196 2014-04-10 14:06:24Z linev $
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 für 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 TGo4Thread_H
15 #define TGo4Thread_H
16 
17 #include "TNamed.h"
18 
19 class TThread;
20 class TCondition;
21 class TGo4Runnable;
22 
32 class TGo4Thread : public TNamed {
33 
34  public:
35 
36  TGo4Thread(const TGo4Thread &right);
37 
43  TGo4Thread (const char* name, TGo4Runnable* runnable, Bool_t internal = kTRUE);
44 
45  virtual ~TGo4Thread();
46 
48  Bool_t Create();
49 
51  Bool_t Cancel();
52 
56  Bool_t ReCreate();
57 
60  Bool_t Start();
61 
63  Bool_t Stop();
64 
67  static void Sleep(UInt_t millisecs);
68 
70  Int_t GetPID() const { return fiThreadPID; }
71 
73  Long_t GetSelfID() const { return fiThreadSelfID; }
74 
77  Bool_t IsInternal() const { return fbIsInternal; }
78 
80  Bool_t IsCreated() const { return fbIsCreated; }
81 
83  Bool_t IsRunning() const { return fbIsRunning; }
84 
86  Bool_t IsWaiting() const { return fbIsWaiting; }
87 
88  private:
89 
94  static void Threadfunc (void* arg);
95 
97  TGo4Runnable* GetRunnable() const { return fxRunnable; }
98 
99  TCondition* GetCondition() const { return fxCondition; }
100 
101  void SetPID();
102 
103  void SetSelfID();
104 
105  void SetWaiting(Bool_t mode=kTRUE) { fbIsWaiting=mode; }
106 
112  Bool_t fbIsInternal;
113 
115  Bool_t fbIsCreated;
116 
118  Bool_t fbIsRunning;
119 
121  Int_t fiThreadPID;
122 
125 
127  Bool_t fbIsWaiting;
128 
137 
138  TThread *fxThread;
139 
140  TCondition *fxCondition;
141 
142  private:
143  TGo4Thread();
144 };
145 
146 #endif
Bool_t IsRunning() const
Definition: TGo4Thread.h:83
Bool_t Stop()
Definition: TGo4Thread.cxx:328
void SetWaiting(Bool_t mode=kTRUE)
Definition: TGo4Thread.h:105
Bool_t Cancel()
Definition: TGo4Thread.cxx:187
static void Sleep(UInt_t millisecs)
Definition: TGo4Thread.cxx:336
static void Threadfunc(void *arg)
Definition: TGo4Thread.cxx:75
Bool_t IsCreated() const
Definition: TGo4Thread.h:80
Bool_t IsWaiting() const
Definition: TGo4Thread.h:86
TThread * fxThread
Definition: TGo4Thread.h:138
TCondition * fxCondition
Definition: TGo4Thread.h:140
Long_t GetSelfID() const
Definition: TGo4Thread.h:73
Bool_t IsInternal() const
Definition: TGo4Thread.h:77
void SetPID()
Definition: TGo4Thread.cxx:348
TGo4Runnable * GetRunnable() const
Definition: TGo4Thread.h:97
Long_t fiThreadSelfID
Definition: TGo4Thread.h:124
virtual ~TGo4Thread()
Definition: TGo4Thread.cxx:53
TGo4Runnable * fxRunnable
Definition: TGo4Thread.h:136
Int_t fiThreadPID
Definition: TGo4Thread.h:121
Bool_t fbIsRunning
Definition: TGo4Thread.h:118
Bool_t ReCreate()
Definition: TGo4Thread.cxx:251
Bool_t fbIsInternal
Definition: TGo4Thread.h:112
Bool_t Create()
Definition: TGo4Thread.cxx:167
Bool_t fbIsCreated
Definition: TGo4Thread.h:115
void SetSelfID()
Definition: TGo4Thread.cxx:343
Bool_t Start()
Definition: TGo4Thread.cxx:307
Bool_t fbIsWaiting
Definition: TGo4Thread.h:127
Int_t GetPID() const
Definition: TGo4Thread.h:70
TCondition * GetCondition() const
Definition: TGo4Thread.h:99