Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TPosixMutex.cxx
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//////////////////////////////////////////////////////////////////////////
13// //
14// TPosixMutex //
15// //
16// This class provides an interface to the posix mutex routines. //
17// //
18//////////////////////////////////////////////////////////////////////////
19
20#include "TPosixMutex.h"
21
22////////////////////////////////////////////////////////////////////////////////
23/// Create a posix mutex lock.
24
26{
27 if (recursive) {
29
30 int rc;
32
34
35 if (!rc) {
37 if (!rc) {
39 if (rc)
40 SysError("TPosixMutex", "pthread_mutex_init error");
41 } else
42 SysError("TPosixMutex", "pthread_mutexattr_settype error");
43 } else
44 SysError("TPosixMutex", "pthread_mutex_init error");
45
47
48 } else {
49
50 int rc = pthread_mutex_init(&fMutex, nullptr);
51 if (rc)
52 SysError("TPosixMutex", "pthread_mutex_init error");
53
54 }
55}
56
57////////////////////////////////////////////////////////////////////////////////
58/// TMutex dtor.
59
61{
63 if (rc)
64 SysError("~TPosixMutex", "pthread_mutex_destroy error");
65}
66
67////////////////////////////////////////////////////////////////////////////////
68/// Lock the mutex.
69
74
75////////////////////////////////////////////////////////////////////////////////
76/// Try locking the mutex. Returns 0 if mutex can be locked.
77
82
83////////////////////////////////////////////////////////////////////////////////
84/// Unlock the mutex.
85
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
Definition TObject.cxx:1110
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:886
pthread_mutex_t fMutex
Definition TPosixMutex.h:33
Int_t UnLock() override
Unlock the mutex.
static constexpr int kIsRecursive
Definition TPosixMutex.h:35
TPosixMutex(Bool_t recursive=kFALSE)
Create a posix mutex lock.
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.