Source code of Windows XP (NT5)
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

  1. // ReadWriteLock.h: interface for the CReadWriteLock class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #pragma once
  5. class CReadWriteLock
  6. {
  7. public:
  8. CReadWriteLock();
  9. ~CReadWriteLock();
  10. BOOL Init();
  11. void EnterWriteLock();
  12. void EnterReadLock();
  13. void LeaveLock();
  14. private:
  15. int m_nWriterWaitingCount;
  16. int m_nReaderWaitingCount;
  17. int m_nActiveCount;
  18. HANDLE m_hWriteSem;
  19. HANDLE m_hReadSem;
  20. BOOL m_fCritSecInited;
  21. DNCRITICAL_SECTION m_csWrite;
  22. DEBUG_ONLY(DWORD m_dwWriteThread);
  23. };