ZenLib
ZenLib
CriticalSection.h
Go to the documentation of this file.
1
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
2
*
3
* Use of this source code is governed by a zlib-style license that can
4
* be found in the License.txt file in the root of the source tree.
5
*/
6
7
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8
//
9
// CriticalSection functions
10
//
11
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12
13
//---------------------------------------------------------------------------
14
#ifndef ZenLib_CriticalSectionH
15
#define ZenLib_CriticalSectionH
16
//---------------------------------------------------------------------------
17
18
//---------------------------------------------------------------------------
19
#ifdef CS
20
#undef CS //Solaris defines this somewhere
21
#endif
22
//---------------------------------------------------------------------------
23
24
namespace
ZenLib
25
{
26
27
//***************************************************************************
28
/// @brief CriticalSection manipulation
29
//***************************************************************************
30
31
class
CriticalSection
32
{
33
public :
34
//Constructor/Destructor
35
CriticalSection
();
36
~CriticalSection
();
37
38
//Enter/Leave
39
void
Enter
();
40
void
Leave
();
41
42
private :
43
void
* CritSect;
44
};
45
46
//***************************************************************************
47
/// @brief CriticalSectionLocker helper
48
//***************************************************************************
49
50
class
CriticalSectionLocker
51
{
52
public
:
53
CriticalSectionLocker
(
ZenLib::CriticalSection
&CS)
54
{
55
CritSec=&CS;
56
CritSec->
Enter
();
57
}
58
59
~CriticalSectionLocker
()
60
{
61
CritSec->
Leave
();
62
}
63
64
private
:
65
ZenLib::CriticalSection
*CritSec;
66
};
67
68
}
//NameSpace
69
70
#endif
ZenLib::CriticalSectionLocker::CriticalSectionLocker
CriticalSectionLocker(ZenLib::CriticalSection &CS)
Definition:
CriticalSection.h:53
ZenLib::CriticalSectionLocker::~CriticalSectionLocker
~CriticalSectionLocker()
Definition:
CriticalSection.h:59
ZenLib::CriticalSection::Leave
void Leave()
ZenLib::CriticalSectionLocker
CriticalSectionLocker helper.
Definition:
CriticalSection.h:50
ZenLib::CriticalSection::CriticalSection
CriticalSection()
ZenLib
Definition:
BitStream.h:23
ZenLib::CriticalSection::Enter
void Enter()
ZenLib::CriticalSection
CriticalSection manipulation.
Definition:
CriticalSection.h:31
ZenLib::CriticalSection::~CriticalSection
~CriticalSection()
Generated by
1.8.17