ROOT logo
// @(#)root/thread:$Id: TMutex.h 20882 2007-11-19 11:31:26Z rdm $
// Author: Fons Rademakers   26/06/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_TMutex
#define ROOT_TMutex


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TMutex                                                               //
//                                                                      //
// This class implements mutex locks. A mutex is a mutual exclusive     //
// lock. The actual work is done via the TMutexImp class (either        //
// TPosixMutex or TWin32Mutex).                                         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TVirtualMutex
#include "TVirtualMutex.h"
#endif
#ifndef ROOT_TThread
#include "TThread.h"
#endif
#ifndef ROOT_TMutexImp
#include "TMutexImp.h"
#endif


class TMutex : public TVirtualMutex {

friend class TCondition;
friend class TThread;

private:
   TMutexImp  *fMutexImp;   // pointer to mutex implementation
   Long_t      fId;         // id of thread which locked mutex
   Int_t       fRef;        // reference count in case of recursive locking by same thread

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

public:
   TMutex(Bool_t recursive = kFALSE);
   virtual ~TMutex() { delete fMutexImp; }

   Int_t  Lock();
   Int_t  TryLock();
   Int_t  UnLock();
   Int_t  CleanUp();

   TVirtualMutex *Factory(Bool_t recursive = kFALSE);

   ClassDef(TMutex,0)  // Mutex lock class
};

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