Logo ROOT   6.08/07
Reference Guide
TMutex.h
Go to the documentation of this file.
1 // @(#)root/thread:$Id$
2 // Author: Fons Rademakers 26/06/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_TMutex
13 #define ROOT_TMutex
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TMutex //
19 // //
20 // This class implements mutex locks. A mutex is a mutual exclusive //
21 // lock. The actual work is done via the TMutexImp class (either //
22 // TPosixMutex or TWin32Mutex). //
23 // //
24 //////////////////////////////////////////////////////////////////////////
25 
26 #ifndef ROOT_TVirtualMutex
27 #include "TVirtualMutex.h"
28 #endif
29 #ifndef ROOT_TMutexImp
30 #include "TMutexImp.h"
31 #endif
32 
33 
34 class TMutex : public TVirtualMutex {
35 
36 friend class TCondition;
37 friend class TThread;
38 
39 private:
40  TMutexImp *fMutexImp; // pointer to mutex implementation
41 
42  TMutex(const TMutex&); // not implemented
43  TMutex& operator=(const TMutex&); // not implemented
44 
45 public:
46  TMutex(Bool_t recursive = kFALSE);
47  virtual ~TMutex() { delete fMutexImp; }
48 
49  Int_t Lock();
50  Int_t TryLock();
51  Int_t UnLock();
52  Int_t CleanUp();
53 
54  TVirtualMutex *Factory(Bool_t recursive = kFALSE);
55 
56  ClassDef(TMutex,0) // Mutex lock class
57 };
58 
59 #endif
Definition: TMutex.h:34
This class implements a mutex interface.
Definition: TVirtualMutex.h:34
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TMutex(const TMutex &)
Int_t UnLock()
Unlock the mutex.
Definition: TMutex.cxx:68
TVirtualMutex * Factory(Bool_t recursive=kFALSE)
Create mutex and return pointer to it.
Definition: TMutex.cxx:87
#define ClassDef(name, id)
Definition: Rtypes.h:254
TMutexImp * fMutexImp
Definition: TMutex.h:40
virtual ~TMutex()
Definition: TMutex.h:47
Int_t CleanUp()
Clean up of mutex.
Definition: TMutex.cxx:76
Int_t TryLock()
Try to lock mutex.
Definition: TMutex.cxx:57
TMutex & operator=(const TMutex &)
Int_t Lock()
Lock the mutex.
Definition: TMutex.cxx:46