class CriticalSectLock
{
public:
CriticalSectLock(CRITICAL_SECTION* cs)
{
m_cs = cs;
if (cs)
EnterCriticalSection(cs);
}
~CriticalSectLock()
{
if (m_cs)
LeaveCriticalSection(m_cs);
}
private:
CRITICAL_SECTION* m_cs;
};
{
public:
CriticalSectLock(CRITICAL_SECTION* cs)
{
m_cs = cs;
if (cs)
EnterCriticalSection(cs);
}
~CriticalSectLock()
{
if (m_cs)
LeaveCriticalSection(m_cs);
}
private:
CRITICAL_SECTION* m_cs;
};