mirror of https://github.com/tongzx/nt5src
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.
30 lines
530 B
30 lines
530 B
// ReadWriteLock.h: interface for the CReadWriteLock class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
class CReadWriteLock
|
|
{
|
|
public:
|
|
CReadWriteLock();
|
|
~CReadWriteLock();
|
|
|
|
BOOL Init();
|
|
|
|
void EnterWriteLock();
|
|
void EnterReadLock();
|
|
|
|
void LeaveLock();
|
|
|
|
private:
|
|
int m_nWriterWaitingCount;
|
|
int m_nReaderWaitingCount;
|
|
int m_nActiveCount;
|
|
HANDLE m_hWriteSem;
|
|
HANDLE m_hReadSem;
|
|
BOOL m_fCritSecInited;
|
|
DNCRITICAL_SECTION m_csWrite;
|
|
|
|
DEBUG_ONLY(DWORD m_dwWriteThread);
|
|
};
|