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
24namespace ZenLib
25{
26
27//***************************************************************************
28/// @brief CriticalSection manipulation
29//***************************************************************************
30
32{
33public :
34 //Constructor/Destructor
37
38 //Enter/Leave
39 void Enter();
40 void Leave();
41
42private :
43 void* CritSect;
44};
45
46//***************************************************************************
47/// @brief CriticalSectionLocker helper
48//***************************************************************************
49
51{
52public:
54 {
55 CritSec=&CS;
56 CritSec->Enter();
57 }
58
60 {
61 CritSec->Leave();
62 }
63
64private:
66};
67
68} //NameSpace
69
70#endif
CriticalSectionLocker helper.
Definition CriticalSection.h:51
~CriticalSectionLocker()
Definition CriticalSection.h:59
CriticalSectionLocker(ZenLib::CriticalSection &CS)
Definition CriticalSection.h:53
CriticalSection manipulation.
Definition CriticalSection.h:32
Definition BitStream.h:24