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.

75 lines
1.2 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. CritSec.h
  5. Abstract:
  6. This file provides declaration of the service
  7. Critical Section wrapper class.
  8. Author:
  9. Oded Sacher (OdedS) Nov, 2000
  10. Revision History:
  11. --*/
  12. #ifndef _FAX_CRIT_SEC_H
  13. #define _FAX_CRIT_SEC_H
  14. #include "faxutil.h"
  15. /************************************
  16. * *
  17. * CFaxCriticalSection *
  18. * *
  19. ************************************/
  20. class CFaxCriticalSection
  21. {
  22. public:
  23. CFaxCriticalSection () : m_bInit(FALSE) {}
  24. ~CFaxCriticalSection ()
  25. {
  26. SafeDelete();
  27. return;
  28. }
  29. BOOL Initialize ();
  30. #if (_WIN32_WINNT >= 0x0403)
  31. BOOL InitializeAndSpinCount (DWORD dwSpinCount = (DWORD)0x80000000);
  32. #endif
  33. VOID SafeDelete ();
  34. #if DBG
  35. LONG LockCount() const
  36. {
  37. return m_CritSec.LockCount;
  38. }
  39. HANDLE OwningThread() const
  40. {
  41. return m_CritSec.OwningThread;
  42. }
  43. #endif //#if DBG
  44. LPCRITICAL_SECTION operator & ()
  45. {
  46. return &m_CritSec;
  47. }
  48. private:
  49. CRITICAL_SECTION m_CritSec;
  50. BOOL m_bInit;
  51. }; // CFaxCriticalSection
  52. #endif