ZenLib
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
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
Generated on Sun Apr 24 2016 16:46:23 for ZenLib by
1.8.1.2