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.

73 lines
1.0 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. SleepN.hxx
  6. Abstract:
  7. Handles delayed callbacks. Delay must be < 49.7 days, and the
  8. callback must execute very quickly.
  9. Author:
  10. Albert Ting (AlbertT) 19-Dec-1994
  11. Revision History:
  12. --*/
  13. #ifndef _SLEEPN_HXX
  14. #define _SLEEPN_HXX
  15. typedef DWORD TICKCOUNT;
  16. class TSleepNotify;
  17. class VSleepWorker {
  18. friend TSleepNotify;
  19. SIGNATURE( 'slpw' )
  20. private:
  21. DLINK( VSleepWorker, SleepWorker );
  22. TICKCOUNT TickCountWake;
  23. virtual VOID vCallback( VOID ) = 0;
  24. };
  25. class TSleepNotify {
  26. SIGNATURE( 'slpn' )
  27. SAFE_NEW
  28. private:
  29. enum {
  30. kTickCountMargin = 1000*60*60,
  31. };
  32. MCritSec _CritSec;
  33. HANDLE _hEvent;
  34. DLINK_BASE( VSleepWorker, SleepWorker, SleepWorker );
  35. public:
  36. TSleepNotify( VOID );
  37. BOOL
  38. bValid(
  39. VOID
  40. ) const
  41. {
  42. return _hEvent != NULL;
  43. }
  44. VOID vRun( VOID );
  45. VOID vAdd( VSleepWorker& SleepWorker, TICKCOUNT TickCountWake );
  46. };
  47. #endif // ndef _SLEEPN_HXX