ROOT
6.14/05
Reference Guide
core
base
src
TVirtualMutex.cxx
Go to the documentation of this file.
1
// @(#)root/base:$Id$
2
// Author: Fons Rademakers 14/02/2002
3
4
/*************************************************************************
5
* Copyright (C) 1995-2002, 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
/** \class TVirtualMutex
13
\ingroup Base
14
15
This class implements a mutex interface. The actual work is done via
16
TMutex which is available as soon as the thread library is loaded.
17
18
and
19
20
TLockGuard
21
22
This class provides mutex resource management in a guaranteed and
23
exception safe way. Use like this:
24
~~~ {.cpp}
25
{
26
TLockGuard guard(mutex);
27
... // do something
28
}
29
~~~
30
when guard goes out of scope the mutex is unlocked in the TLockGuard
31
destructor. The exception mechanism takes care of calling the dtors
32
of local objects so it is exception safe.
33
*/
34
35
#include "
TVirtualMutex.h
"
36
#include "
TVirtualRWMutex.h
"
37
38
ClassImp
(
TVirtualMutex
);
39
ClassImp
(
TLockGuard
);
40
41
// Global mutex set in TThread::Init protecting creation
42
// of other (preferably local) mutexes. Note that in this
43
// concept gGlobalMutex must be used in TStorage to prevent
44
// lockup of the system (see TMutex::Factory)
45
TVirtualMutex
*
gGlobalMutex
= 0;
46
47
// From TVirtualRWMutex.h:
48
ROOT::TVirtualRWMutex::State::~State
() =
default
;
49
ROOT::TVirtualRWMutex::StateDelta::~StateDelta
() =
default
;
TVirtualMutex
This class implements a mutex interface.
Definition:
TVirtualMutex.h:34
TVirtualRWMutex.h
TVirtualMutex.h
TLockGuard
Definition:
TVirtualMutex.h:69
ROOT::TVirtualRWMutex::StateDelta::~StateDelta
virtual ~StateDelta()
ROOT::TVirtualRWMutex::State::~State
virtual ~State()
gGlobalMutex
TVirtualMutex * gGlobalMutex
Definition:
TVirtualMutex.cxx:45
ClassImp
#define ClassImp(name)
Definition:
Rtypes.h:359