ROOT  6.06/09
Reference Guide
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 
14 This class implements a mutex interface. The actual work is done via
15 TMutex which is available as soon as the thread library is loaded.
16 
17 and
18 
19 TLockGuard
20 
21 This class provides mutex resource management in a guaranteed and
22 exception safe way. Use like this:
23 ~~~ {.cpp}
24 {
25  TLockGuard guard(mutex);
26  ... // do something
27 }
28 ~~~
29 when guard goes out of scope the mutex is unlocked in the TLockGuard
30 destructor. The exception mechanism takes care of calling the dtors
31 of local objects so it is exception safe.
32 */
33 
34 #include "TVirtualMutex.h"
35 
38 
39 // Global mutex set in TThread::Init protecting creation
40 // of other (preferably local) mutexes. Note that in this
41 // concept gGlobalMutex must be used in TStorage to prevent
42 // lockup of the system (see TMutex::Factory)
43 TVirtualMutex *gGlobalMutex = 0;
This class implements a mutex interface.
Definition: TVirtualMutex.h:34
ClassImp(TVirtualMutex) ClassImp(TLockGuard) TVirtualMutex *gGlobalMutex=0