// @(#)root/thread:$Id$
// Author: Fons Rademakers   01/07/97

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TCondition
#define ROOT_TCondition


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// 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).                   //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TConditionImp
#include "TConditionImp.h"
#endif

class TMutex;


class TCondition : public TObject {

friend class TThread;

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

   TCondition(const TCondition&);             // not implemented
   TCondition& operator=(const TCondition&);  // not implemented

public:
   TCondition(TMutex *m = 0);
   virtual ~TCondition();

   TMutex *GetMutex() const;

   Int_t   Wait();
   Int_t   TimedWait(ULong_t secs, ULong_t nanoSecs);
   Int_t   TimedWaitRelative(ULong_t ms);
   Int_t   Signal() { if (fConditionImp) return fConditionImp->Signal(); return -1; }
   Int_t   Broadcast() { if (fConditionImp) return fConditionImp->Broadcast(); return -1; }

   ClassDef(TCondition,0)  // Condition variable class
};

#endif
 TCondition.h:1
 TCondition.h:2
 TCondition.h:3
 TCondition.h:4
 TCondition.h:5
 TCondition.h:6
 TCondition.h:7
 TCondition.h:8
 TCondition.h:9
 TCondition.h:10
 TCondition.h:11
 TCondition.h:12
 TCondition.h:13
 TCondition.h:14
 TCondition.h:15
 TCondition.h:16
 TCondition.h:17
 TCondition.h:18
 TCondition.h:19
 TCondition.h:20
 TCondition.h:21
 TCondition.h:22
 TCondition.h:23
 TCondition.h:24
 TCondition.h:25
 TCondition.h:26
 TCondition.h:27
 TCondition.h:28
 TCondition.h:29
 TCondition.h:30
 TCondition.h:31
 TCondition.h:32
 TCondition.h:33
 TCondition.h:34
 TCondition.h:35
 TCondition.h:36
 TCondition.h:37
 TCondition.h:38
 TCondition.h:39
 TCondition.h:40
 TCondition.h:41
 TCondition.h:42
 TCondition.h:43
 TCondition.h:44
 TCondition.h:45
 TCondition.h:46
 TCondition.h:47
 TCondition.h:48
 TCondition.h:49
 TCondition.h:50
 TCondition.h:51
 TCondition.h:52
 TCondition.h:53
 TCondition.h:54
 TCondition.h:55
 TCondition.h:56
 TCondition.h:57
 TCondition.h:58
 TCondition.h:59
 TCondition.h:60
 TCondition.h:61
 TCondition.h:62
 TCondition.h:63