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.
36 lines
756 B
36 lines
756 B
// ReadWriteLock.h: interface for the CReadWriteLock class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
class CReadWriteLock
|
|
{
|
|
public:
|
|
BOOL Initialize();
|
|
void Deinitialize();
|
|
|
|
void EnterWriteLock();
|
|
void EnterReadLock();
|
|
|
|
void LeaveLock();
|
|
|
|
private:
|
|
BOOL m_fCritSecInited;
|
|
#ifdef DPNBUILD_ONLYONETHREAD
|
|
#ifdef DBG
|
|
// Used to ensure that no one re-enters
|
|
DWORD m_dwThreadID;
|
|
#endif // DBG
|
|
#else // ! DPNBUILD_ONLYONETHREAD
|
|
LONG m_lWriterCount;
|
|
LONG m_lReaderCount;
|
|
BOOL m_fWriterMode;
|
|
DNCRITICAL_SECTION m_csWrite;
|
|
|
|
#ifdef DBG
|
|
// Used to ensure that no one re-enters
|
|
DWORD m_dwWriteThread;
|
|
#endif // DBG
|
|
#endif // ! DPNBUILD_ONLYONETHREAD
|
|
};
|