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.

66 lines
1.6 KiB

  1. //////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // CriticalSection.h
  4. //
  5. // Copyright (C) 1998, 1999 Microsoft Corporation. All rights reserved.
  6. //
  7. // Abstract :
  8. //
  9. // This include files supports the CCriticalSection class object.
  10. //
  11. // History :
  12. //
  13. // 05/06/1999 luish Created
  14. //
  15. //////////////////////////////////////////////////////////////////////////////////////////////
  16. #ifndef __CRITICALSECTION_
  17. #define __CRITICALSECTION_
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #include <windows.h>
  22. #include <objbase.h>
  23. //////////////////////////////////////////////////////////////////////////////////////////////
  24. #define TEN_SECONDS 10000
  25. //////////////////////////////////////////////////////////////////////////////////////////////
  26. //
  27. // CCriticalSection
  28. //
  29. //////////////////////////////////////////////////////////////////////////////////////////////
  30. class CCriticalSection
  31. {
  32. public:
  33. CCriticalSection(void);
  34. virtual ~CCriticalSection(void);
  35. STDMETHOD (Initialize) (void);
  36. STDMETHOD (Initialize) (const BOOL fOwner);
  37. STDMETHOD (Initialize) (const BOOL fOwner, const CHAR * pName);
  38. STDMETHOD (Shutdown) (void);
  39. STDMETHOD (IsCreator) (void);
  40. STDMETHOD (IsInitialized) (void);
  41. STDMETHOD_(DWORD, GetLockCount) (THIS);
  42. STDMETHOD (Enter) (void);
  43. STDMETHOD (Enter) (const DWORD dwWaitTimer);
  44. STDMETHOD (Leave) (void);
  45. private:
  46. LONG m_lLockCount;
  47. HANDLE m_hAccessMutex;
  48. BOOL m_fCreator;
  49. };
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif // __CRITICALSECTION_