18#pragma comment(user,"T-Coverage Disable")
32 #include "other/MeteredSection.h"
57 NMetered::LPMETERED_SECTION m_pms;
58 mutable LONG m_lLockCount;
69 explicit CSyncMetered(LPCTSTR lpszName = NULL,
int iMaximumCount = 1)
71 ASSERTLIB( lpszName == NULL ||
STRLIB::GetLen(lpszName) < MAX_METSECT_NAMELEN );
72 m_pms = NMetered::CreateMeteredSection(iMaximumCount, iMaximumCount, lpszName);
76 "CSyncMetered::CSyncMetered()",
77 "MeteredSectionが初期化できませんした。名前に問題がある可能性が有ります。"
93 if ( m_lLockCount > 0 )
95 NMetered::LeaveMeteredSection(m_pms, m_lLockCount, NULL);
97 NMetered::CloseMeteredSection(m_pms);
108 virtual bool Lock(DWORD dwTime = INFINITE)
const
112 DWORD dwRc = NMetered::EnterMeteredSection(m_pms, dwTime);
113 if ( dwRc == WAIT_OBJECT_0 )
115 ::InterlockedIncrement(&m_lLockCount);
125 if ( m_pms != NULL && m_lLockCount > 0 )
127 NMetered::LeaveMeteredSection(m_pms, 1, NULL);
128 ::InterlockedDecrement(&m_lLockCount);
140#pragma comment(user,"T-Coverage Enable")
virtual ~CSyncMetered(void)
デストラクタ
CSyncMetered(LPCTSTR lpszName=NULL, int iMaximumCount=1)
コンストラクタ
virtual bool Lock(DWORD dwTime=INFINITE) const
[排他] ロック
virtual void Unlock(void) const
[排他] アンロック
size_t GetLen(LPCSTR lpsz)
[計算] 文字列長計算(ASCII/SJIS用)