library: libThread #include "TCondition.h"

# TCondition

class description - source file - inheritance tree (.pdf)

## class TCondition : public TObject

| Inheritance Chart:
`TObject`
| <- | `TCondition` |

        public:

                          TCondition(TMutex* m = 0)
                          TCondition(const TCondition&)
                  virtual ~TCondition()
                    Int_t Broadcast()
           static TClass* Class()
                  TMutex* GetMutex() const
          virtual TClass* IsA() const
              TCondition& operator=(const TCondition&)
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
                    Int_t Signal()
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
                    Int_t TimedWait(ULong_t secs, ULong_t nanoSecs)
                    Int_t TimedWaitRelative(ULong_t ms)
                    Int_t Wait()

### Data Members

        private:

          TConditionImp* fConditionImp  pointer to condition variable implementation
                 TMutex* fMutex         mutex used around Wait() and TimedWait()
                  Bool_t fPrivateMutex  is fMutex our private mutex

## Class Description

     TCondition

     This class implements a condition variable. Use a condition variable
     to signal threads. The actual work is done via the TConditionImp
     class (either TPosixCondition or TWin32Condition).

TCondition(TMutex *m)

     Create a condition variable. The actual condition implementation
     will be provided via the TThreadFactory. If no external mutex is
     provided one will be created. Use GetMutex() to get this mutex
     and use it before calling Signal() or Broadcast().

~TCondition()

     Clean up condition variable.

TMutex* GetMutex() const

     Get internally created mutex. Use it to lock resources
     before calling Signal() or Broadcast(). Returns 0 if
     external mutex was provided in TCondition ctor.

Int_t Wait()

     Wait to be signaled.

Int_t TimedWait(ULong_t secs, ULong_t nanoSec)

     Wait to be signaled or till the timer times out.
     This method is given an absolute time since the beginning of
     the EPOCH (use TThread::GetTime() to get this absolute time).
     To wait for a relative time from now, use
     TCondition::TimedWaitRelative(ULong_t ms).
     Returns 0 if successfully signalled, 1 if time expired and -1 in
     case of error.

Int_t TimedWaitRelative(ULong_t ms)

     Wait to be signaled or till the timer times out.
     This method is given a relative time from now.
     To wait for an absolute time since the beginning of the EPOCH, use
     TCondition::TimedWait(ULong_t secs, ULong_t nanoSec).
     Returns 0 if successfully signalled, 1 if time expired and -1 in
     case of error.

### Inline Functions

                  Int_t Signal()
                  Int_t Broadcast()
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
             TCondition TCondition(const TCondition&)
            TCondition& operator=(const TCondition&)

Author: Fons Rademakers 01/07/97
Last update: root/thread:$Name: $:$Id: TCondition.cxx,v 1.7 2005/05/27 08:48:27 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *