GSI Object Oriented Online Offline (Go4)
GO4-5.3.2
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Go4LockGuard
TGo4LockGuard.cxx
Go to the documentation of this file.
1
// $Id: TGo4LockGuard.cxx 1455 2015-05-28 14:24:57Z linev $
2
//-----------------------------------------------------------------------
3
// The GSI Online Offline Object Oriented (Go4) Project
4
// Experiment Data Processing at EE department, GSI
5
//-----------------------------------------------------------------------
6
// Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7
// Planckstr. 1, 64291 Darmstadt, Germany
8
// Contact: http://go4.gsi.de
9
//-----------------------------------------------------------------------
10
// This software can be used under the license agreements as stated
11
// in Go4License.txt file which is part of the distribution.
12
//-----------------------------------------------------------------------
13
14
#include "
TGo4LockGuard.h
"
15
16
#include "TMutex.h"
17
18
TMutex*
TGo4LockGuard::fgxMainMutex
= 0;
19
20
Int_t
TGo4LockGuard::fgiLockCount
= 0;
21
22
23
TGo4LockGuard::TGo4LockGuard
(TMutex* mutex, Bool_t)
24
{
25
// first call: create main mutex
26
// std::cout <<"G-----TGo4LockGuard ctor" << std::endl;
27
//
28
if
(
fgxMainMutex
==0)
29
fgxMainMutex
=
new
TMutex(kTRUE);
// we use recursive mode for cascading lockguards
30
if
(mutex==0) {
31
// use global mutex
32
fxMutex
=
fgxMainMutex
;
33
fbIsMainMutex
= kTRUE;
34
}
else
{
35
// use external mutex
36
fxMutex
= mutex;
37
fbIsMainMutex
= kFALSE;
38
}
39
40
fxMutex
->Lock();
41
fbIsLocked
= kTRUE;
42
if
(
fbIsMainMutex
)
fgiLockCount
++;
43
}
44
45
TGo4LockGuard::~TGo4LockGuard
()
46
{
47
if
(
fbIsLocked
) {
48
if
(
fbIsMainMutex
)
fgiLockCount
--;
49
fxMutex
->UnLock();
50
}
51
}
52
53
Int_t
TGo4LockGuard::MainMutexLockCount
()
54
{
55
return
fgiLockCount
;
56
}
57
58
void
TGo4LockGuard::LockMainMutex
()
59
{
60
fgxMainMutex
->Lock();
61
}
62
63
void
TGo4LockGuard::UnLockMainMutex
()
64
{
65
fgxMainMutex
->UnLock();
66
}
TGo4LockGuard::MainMutexLockCount
static Int_t MainMutexLockCount()
Definition:
TGo4LockGuard.cxx:53
TGo4LockGuard::TGo4LockGuard
TGo4LockGuard()
Definition:
TGo4LockGuard.h:24
TGo4LockGuard.h
TGo4LockGuard::fbIsMainMutex
Bool_t fbIsMainMutex
Definition:
TGo4LockGuard.h:63
TGo4LockGuard::fbIsLocked
Bool_t fbIsLocked
Definition:
TGo4LockGuard.h:59
TGo4LockGuard::fxMutex
TMutex * fxMutex
Definition:
TGo4LockGuard.h:56
TGo4LockGuard::fgxMainMutex
static TMutex * fgxMainMutex
Definition:
TGo4LockGuard.h:69
TGo4LockGuard::UnLockMainMutex
static void UnLockMainMutex()
Definition:
TGo4LockGuard.cxx:63
TGo4LockGuard::fgiLockCount
static Int_t fgiLockCount
Definition:
TGo4LockGuard.h:72
TGo4LockGuard::~TGo4LockGuard
virtual ~TGo4LockGuard()
Definition:
TGo4LockGuard.cxx:45
TGo4LockGuard::LockMainMutex
static void LockMainMutex()
Definition:
TGo4LockGuard.cxx:58
Generated on Fri Oct 26 2018 08:34:52 for GSI Object Oriented Online Offline (Go4) by
1.8.8