Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

39 lines
885 B

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Microsoft WMI OLE DB Provider
// (C) Copyright 1999 Microsoft Corporation. All Rights Reserved.
//
// Generic class which encapsulates CCriticalSection class
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef _AUTOBLOC_H_
#define _AUTOBLOC_H_
class CAutoBlock
{
private:
CCriticalSection *m_pCriticalSection;
public:
CAutoBlock(CCriticalSection *pCriticalSection);
~CAutoBlock();
};
inline CAutoBlock::CAutoBlock(CCriticalSection *pCriticalSection)
{
m_pCriticalSection = NULL;
if(pCriticalSection)
pCriticalSection->Enter();
m_pCriticalSection = pCriticalSection;
}
inline CAutoBlock::~CAutoBlock()
{
if(m_pCriticalSection)
m_pCriticalSection->Leave();
}
#endif // _AUTOBLOC_H_