Logo ROOT   6.08/07
Reference Guide
TPosixMutex.h
Go to the documentation of this file.
1 // @(#)root/thread:$Id$
2 // Author: Fons Rademakers 25/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_TPosixMutex
13 #define ROOT_TPosixMutex
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TPosixMutex //
19 // //
20 // This class provides an interface to the posix mutex routines. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_TMutexImp
25 #include "TMutexImp.h"
26 #endif
27 
28 #ifndef __CINT__
29 #include <pthread.h>
30 #else
31 struct pthread_mutex_t;
32 #endif
33 
34 class TPosixMutex : public TMutexImp {
35 
36 friend class TPosixCondition;
37 
38 private:
39  pthread_mutex_t fMutex; // the pthread mutex
40 
41 public:
42  TPosixMutex(Bool_t recursive=kFALSE);
43  virtual ~TPosixMutex();
44 
45  Int_t Lock();
46  Int_t UnLock();
47  Int_t TryLock();
48 
49  ClassDef(TPosixMutex,0) // Posix mutex lock
50 };
51 
52 #endif
Int_t UnLock()
Unlock the mutex.
Definition: TPosixMutex.cxx:89
Int_t TryLock()
Try locking the mutex. Returns 0 if mutex can be locked.
Definition: TPosixMutex.cxx:81
pthread_mutex_t fMutex
Definition: TPosixMutex.h:39
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TPosixMutex(Bool_t recursive=kFALSE)
Create a posix mutex lock.
Definition: TPosixMutex.cxx:29
#define ClassDef(name, id)
Definition: Rtypes.h:254
Int_t Lock()
Lock the mutex.
Definition: TPosixMutex.cxx:73
virtual ~TPosixMutex()
TMutex dtor.
Definition: TPosixMutex.cxx:63