Logo ROOT  
Reference Guide
TCondition.h
Go to the documentation of this file.
1 // @(#)root/thread:$Id$
2 // Author: Fons Rademakers 01/07/97
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TCondition
13 #define ROOT_TCondition
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TCondition //
19 // //
20 // This class implements a condition variable. Use a condition variable //
21 // to signal threads. The actual work is done via the TConditionImp //
22 // class (either TPosixCondition or TWin32Condition). //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
26 #include "TObject.h"
27 #include "TConditionImp.h"
28 
29 class TMutex;
30 
31 
32 class TCondition : public TObject {
33 
34 friend class TThread;
35 
36 private:
37  TConditionImp *fConditionImp; // pointer to condition variable implementation
38  TMutex *fMutex; // mutex used around Wait() and TimedWait()
39  Bool_t fPrivateMutex; // is fMutex our private mutex
40 
41  TCondition(const TCondition&); // not implemented
42  TCondition& operator=(const TCondition&); // not implemented
43 
44 public:
45  TCondition(TMutex *m = 0);
46  virtual ~TCondition();
47 
48  TMutex *GetMutex() const;
49 
50  Int_t Wait();
51  Int_t TimedWait(ULong_t secs, ULong_t nanoSecs);
53  Int_t Signal() { if (fConditionImp) return fConditionImp->Signal(); return -1; }
54  Int_t Broadcast() { if (fConditionImp) return fConditionImp->Broadcast(); return -1; }
55 
56  ClassDef(TCondition,0) // Condition variable class
57 };
58 
59 #endif
m
auto * m
Definition: textangle.C:8
TCondition::Wait
Int_t Wait()
Wait to be signaled.
Definition: TCondition.cxx:75
TThread
Definition: TThread.h:40
TCondition::fConditionImp
TConditionImp * fConditionImp
Definition: TCondition.h:37
TCondition
Definition: TCondition.h:32
TCondition::TCondition
TCondition(const TCondition &)
bool
TCondition::TimedWaitRelative
Int_t TimedWaitRelative(ULong_t ms)
Wait to be signaled or till the timer times out.
Definition: TCondition.cxx:114
TConditionImp::Signal
virtual Int_t Signal()=0
TCondition::Signal
Int_t Signal()
Definition: TCondition.h:53
TConditionImp.h
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TCondition::fMutex
TMutex * fMutex
Definition: TCondition.h:38
TCondition::~TCondition
virtual ~TCondition()
Clean up condition variable.
Definition: TCondition.cxx:54
TCondition::TimedWait
Int_t TimedWait(ULong_t secs, ULong_t nanoSecs)
Wait to be signaled or till the timer times out.
Definition: TCondition.cxx:95
TCondition::fPrivateMutex
Bool_t fPrivateMutex
Definition: TCondition.h:39
TObject.h
TConditionImp::Broadcast
virtual Int_t Broadcast()=0
TConditionImp
Definition: TConditionImp.h:26
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TCondition::Broadcast
Int_t Broadcast()
Definition: TCondition.h:54
TGeant4Unit::ms
static constexpr double ms
Definition: TGeant4SystemOfUnits.h:163
TCondition::operator=
TCondition & operator=(const TCondition &)
TMutex
Definition: TMutex.h:30
int
TCondition::GetMutex
TMutex * GetMutex() const
Get internally created mutex.
Definition: TCondition.cxx:65