CriticalSection.h
Go to the documentation of this file.
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a zlib-style license that can
* be found in the License.txt file in the root of the source tree.
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// CriticalSection functions
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
#ifndef ZenLib_CriticalSectionH
#define ZenLib_CriticalSectionH
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#ifdef CS
#undef CS //Solaris defines this somewhere
#endif
//---------------------------------------------------------------------------
namespace ZenLib
{
//***************************************************************************
/// @brief CriticalSection manipulation
//***************************************************************************
class CriticalSection
{
public :
//Constructor/Destructor
CriticalSection ();
~CriticalSection ();
//Enter/Leave
void Enter();
void Leave();
private :
void* CritSect;
};
//***************************************************************************
/// @brief CriticalSectionLocker helper
//***************************************************************************
class CriticalSectionLocker
{
public:
CriticalSectionLocker (ZenLib::CriticalSection &CS)
{
CritSec=&CS;
CritSec->Enter();
}
~CriticalSectionLocker ()
{
CritSec->Leave();
}
private:
ZenLib::CriticalSection *CritSec;
};
} //NameSpace
#endif
ZenLib::CriticalSectionLocker::~CriticalSectionLocker
~CriticalSectionLocker()
Definition CriticalSection.h:59
ZenLib::CriticalSectionLocker::CriticalSectionLocker
CriticalSectionLocker(ZenLib::CriticalSection &CS)
Definition CriticalSection.h:53
ZenLib::CriticalSection
CriticalSection manipulation.
Definition CriticalSection.h:32
ZenLib::CriticalSection::~CriticalSection
~CriticalSection()
ZenLib::CriticalSection::Leave
void Leave()
ZenLib::CriticalSection::CriticalSection
CriticalSection()
ZenLib::CriticalSection::Enter
void Enter()
ZenLib
Definition BitStream.h:24