Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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#include "TMutexImp.h"
25
26#include <pthread.h>
27
28class TPosixMutex : public TMutexImp {
29
30friend class TPosixCondition;
31
32private:
33 pthread_mutex_t fMutex; // the pthread mutex
34
35 constexpr static int kIsRecursive = BIT(14);
36
37public:
38 TPosixMutex(Bool_t recursive=kFALSE);
39 virtual ~TPosixMutex();
40
41 Int_t Lock() override;
42 Int_t UnLock() override;
43 Int_t TryLock() override;
44
45 ClassDefOverride(TPosixMutex,0) // Posix mutex lock
46};
47
48#endif
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
#define BIT(n)
Definition Rtypes.h:85
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
pthread_mutex_t fMutex
Definition TPosixMutex.h:33
Int_t UnLock() override
Unlock the mutex.
static constexpr int kIsRecursive
Definition TPosixMutex.h:35
Int_t Lock() override
Lock the mutex.
Int_t TryLock() override
Try locking the mutex. Returns 0 if mutex can be locked.
virtual ~TPosixMutex()
TMutex dtor.