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.

70 lines
2.0 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. //
  4. // File: aqdbgcnt.h
  5. //
  6. // Description: Provides a per-virtual server mechanism for ensuring that
  7. // the service stops and gives the proper stop hints while stopping. This
  8. // object creates a thread that will ASSERT if stop hints are not called
  9. // often enough. This will allow you to access the debugger while the
  10. // guilty function is taking so much time.
  11. //
  12. // Author: Mike Swafford (MikeSwa)
  13. //
  14. // History:
  15. // 10/27/98 - MikeSwa Created
  16. //
  17. // Copyright (C) 1998 Microsoft Corporation
  18. //
  19. //-----------------------------------------------------------------------------
  20. #ifndef __AQDBGCOUNT_H__
  21. #define __AQDBGCOUNT_H__
  22. #define DEBUG_COUNTDOWN_SIG 'tnCD'
  23. #define DEBUG_COUNTDOWN_DEFAULT_WAIT 20000
  24. //define empty retail functions... to retail ops compile out
  25. #ifdef DEBUG
  26. #define EMPTY_RETAIL_VOID_FUNC
  27. #else //retail
  28. #define EMPTY_RETAIL_VOID_FUNC {}
  29. #endif //DEBUG
  30. //---[ CDebugCountdown ]-------------------------------------------------------
  31. //
  32. //
  33. // Description:
  34. // Class that encapsulates functionality to ensure that stop hints are
  35. // called often enough
  36. // Hungarian:
  37. // dbgcnt, pdbgcnt
  38. //
  39. //-----------------------------------------------------------------------------
  40. class CDebugCountdown
  41. {
  42. protected:
  43. DWORD m_dwSignature;
  44. HANDLE m_hEvent;
  45. HANDLE m_hThread;
  46. DWORD m_dwMilliseconds;
  47. DWORD m_dwFlags;
  48. enum //flags
  49. {
  50. DEBUG_COUNTDOWN_SUSPENDED = 0x00000001,
  51. DEBUG_COUNTDOWN_ENDED = 0x00000002,
  52. };
  53. static DWORD ThreadStartRoutine(PVOID pThis);
  54. public:
  55. CDebugCountdown();
  56. ~CDebugCountdown();
  57. void StartCountdown(DWORD dwMilliseconds = DEBUG_COUNTDOWN_DEFAULT_WAIT) EMPTY_RETAIL_VOID_FUNC;
  58. void SuspendCountdown() EMPTY_RETAIL_VOID_FUNC;
  59. void ResetCountdown() EMPTY_RETAIL_VOID_FUNC;
  60. void EndCountdown() EMPTY_RETAIL_VOID_FUNC;
  61. };
  62. #endif //__AQDBGCOUNT_H__