Leaked source code of windows server 2003
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.

52 lines
1014 B

  1. #ifndef _CSEM_H
  2. #define _CSEM_H
  3. /*****************************************************************************\
  4. * Class CriticalSection - Header file
  5. *
  6. * Copyright (C) 1998 Microsoft Corporation
  7. *
  8. * History:
  9. * Jun 10, 1998, Weihai Chen (weihaic)
  10. *
  11. \*****************************************************************************/
  12. class CCriticalSection
  13. {
  14. public:
  15. CCriticalSection (void);
  16. virtual
  17. ~CCriticalSection (void);
  18. inline BOOL
  19. bValid () CONST { return m_bValid;};
  20. BOOL
  21. Lock (void) const;
  22. BOOL
  23. Unlock (void) const;
  24. private:
  25. CRITICAL_SECTION m_csec;
  26. BOOL m_bValid;
  27. };
  28. typedef class CCriticalSection TCriticalSection;
  29. class TAutoCriticalSection
  30. {
  31. public:
  32. TAutoCriticalSection (
  33. CONST TCriticalSection & refCrit);
  34. ~TAutoCriticalSection (VOID);
  35. BOOL bValid (VOID);
  36. private:
  37. BOOL m_bValid;
  38. const TCriticalSection &m_pCritSec;
  39. };
  40. #endif