ROOT
master
Reference Guide
Loading...
Searching...
No Matches
TWin32Mutex.cxx
Go to the documentation of this file.
1
// @(#)root/thread:$Id$
2
// Author: Bertrand Bellenot 23/10/04
3
4
/*************************************************************************
5
* Copyright (C) 1995-2004, 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
// TWin32Mutex //
15
// //
16
// This class provides an interface to the Win32 mutex routines. //
17
// //
18
//////////////////////////////////////////////////////////////////////////
19
20
#ifndef _WIN32_WINNT
21
#define _WIN32_WINNT 0x0501
// needed for TryEnterCriticalSection
22
#endif
23
24
#include "
TThread.h
"
25
#include "
TWin32Mutex.h
"
26
27
28
////////////////////////////////////////////////////////////////////////////////
29
/// Create a Win32 mutex lock.
30
31
TWin32Mutex::TWin32Mutex
(
Bool_t
recursive
) :
TMutexImp
()
32
{
33
::InitializeCriticalSection
(&
fCritSect
);
34
}
35
36
////////////////////////////////////////////////////////////////////////////////
37
/// TMutex dtor.
38
39
TWin32Mutex::~TWin32Mutex
()
40
{
41
::DeleteCriticalSection
(&
fCritSect
);
42
}
43
44
////////////////////////////////////////////////////////////////////////////////
45
/// Lock the mutex.
46
47
Int_t
TWin32Mutex::Lock
()
48
{
49
::EnterCriticalSection
(&
fCritSect
);
50
return
0;
51
}
52
53
////////////////////////////////////////////////////////////////////////////////
54
/// Try locking the mutex. Returns 0 if mutex can be locked.
55
56
Int_t
TWin32Mutex::TryLock
()
57
{
58
if
(
::TryEnterCriticalSection
(&
fCritSect
))
59
return
0;
60
return
1;
61
}
62
63
////////////////////////////////////////////////////////////////////////////////
64
/// Unlock the mutex.
65
66
Int_t
TWin32Mutex::UnLock
(
void
)
67
{
68
::LeaveCriticalSection
(&
fCritSect
);
69
return
0;
70
}
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
TThread.h
TWin32Mutex.h
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TMutexImp
Definition
TMutexImp.h:27
TWin32Mutex::Lock
Int_t Lock() override
Lock the mutex.
Definition
TWin32Mutex.cxx:47
TWin32Mutex::UnLock
Int_t UnLock() override
Unlock the mutex.
Definition
TWin32Mutex.cxx:66
TWin32Mutex::~TWin32Mutex
virtual ~TWin32Mutex()
TMutex dtor.
Definition
TWin32Mutex.cxx:39
TWin32Mutex::TWin32Mutex
TWin32Mutex(Bool_t recursive=kFALSE)
Create a Win32 mutex lock.
Definition
TWin32Mutex.cxx:31
TWin32Mutex::TryLock
Int_t TryLock() override
Try locking the mutex. Returns 0 if mutex can be locked.
Definition
TWin32Mutex.cxx:56
TWin32Mutex::fCritSect
CRITICAL_SECTION fCritSect
Definition
TWin32Mutex.h:33
bool
int
core
thread
src
TWin32Mutex.cxx
ROOT master - Reference Guide Generated on Sun Sep 21 2025 15:07:46 (GVA Time) using Doxygen 1.10.0