mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-15 02:29:36 +08:00
51 lines
781 B
C++
51 lines
781 B
C++
#pragma once
|
|
|
|
#ifdef _DEBUG
|
|
// #define _DBG_CS
|
|
#endif
|
|
|
|
class AVSOfficeCriticalSection
|
|
{
|
|
public:
|
|
AVSOfficeCriticalSection()
|
|
{
|
|
#ifdef _DBG_CS
|
|
m_dbgCount = 0L;
|
|
#endif
|
|
InitializeCriticalSection (&m_CS);
|
|
}
|
|
|
|
~AVSOfficeCriticalSection()
|
|
{
|
|
DeleteCriticalSection (&m_CS);
|
|
#ifdef _DBG_CS
|
|
++m_dbgCount;
|
|
ATLTRACE (_T("delCS : %d\n"), m_dbgCount);
|
|
#endif
|
|
}
|
|
|
|
inline void Enter()
|
|
{
|
|
EnterCriticalSection (&m_CS);
|
|
#ifdef _DBG_CS
|
|
++m_dbgCount;
|
|
ATLTRACE (_T("dbgCS : %d\n"), m_dbgCount);
|
|
#endif
|
|
}
|
|
|
|
inline void Leave()
|
|
{
|
|
LeaveCriticalSection (&m_CS);
|
|
#ifdef _DBG_CS
|
|
--m_dbgCount;
|
|
ATLTRACE (_T("dbgCS : %d\n"), m_dbgCount);
|
|
#endif
|
|
}
|
|
|
|
private:
|
|
|
|
CRITICAL_SECTION m_CS;
|
|
#ifdef _DBG_CS
|
|
LONG m_dbgCount;
|
|
#endif
|
|
}; |