Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
15This class implements a mutex interface. The actual work is done via
16TMutex which is available as soon as the thread library is loaded.
17
18and
19
20TLockGuard
21
22This class provides mutex resource management in a guaranteed and
23exception safe way. Use like this:
24~~~ {.cpp}
25{
26 TLockGuard guard(mutex);
27 ... // do something
28}
29~~~
30when guard goes out of scope the mutex is unlocked in the TLockGuard
31destructor. The exception mechanism takes care of calling the dtors
32of local objects so it is exception safe.
33*/
34
35#include "TVirtualMutex.h"
36#include "TVirtualRWMutex.h"
37
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)
46
47// From TVirtualRWMutex.h:
#define ClassImp(name)
Definition Rtypes.h:364
TVirtualMutex * gGlobalMutex
This class implements a mutex interface.