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.

68 lines
1.6 KiB

  1. //***************************************************************************
  2. //
  3. // FileName:
  4. // $Workfile: timeout.h $
  5. //
  6. // Author:
  7. // TOSHIBA [PCS](PSY) Seiichi Nakamura
  8. // Copyright (c) 1997 TOSHIBA CORPORATION
  9. //
  10. // Description:
  11. //
  12. //***************************************************************************
  13. // $Header: /DVD Drivers/ZiVA.VxD/timeout.h 2 97/07/11 16:56 Yagi $
  14. // $Modtime: 97/07/11 11:14 $
  15. // $Nokeywords:$
  16. //***************************************************************************
  17. #ifndef _TIMEOUT_H_
  18. #define _TIMEOUT_H_
  19. //---------------------------------------------------------------------------
  20. // Timeout Class
  21. //---------------------------------------------------------------------------
  22. class CTimeOut
  23. {
  24. private:
  25. DWORD m_StartTime;
  26. DWORD m_WaitTime;
  27. DWORD m_SleepTime;
  28. IKernelService *m_pKernelService;
  29. public:
  30. CTimeOut( DWORD WaitTime, DWORD SleepTime, IKernelService *pKernelService )
  31. {
  32. ASSERT( pKernelService != NULL );
  33. m_pKernelService = pKernelService;
  34. m_WaitTime = WaitTime;
  35. m_SleepTime = SleepTime;
  36. m_pKernelService->GetTickCount( &m_StartTime );
  37. };
  38. BOOL CheckTimeOut( void )
  39. {
  40. DWORD m_CurrentTime;
  41. m_pKernelService->GetTickCount( &m_CurrentTime );
  42. if( m_CurrentTime - m_StartTime > m_WaitTime )
  43. return TRUE;
  44. return FALSE;
  45. };
  46. void Sleep( void )
  47. {
  48. // m_pKernelService->Sleep( m_WaitTime );
  49. m_pKernelService->Sleep( m_SleepTime );
  50. };
  51. };
  52. #endif // _TIMEOUT_H_
  53. //***************************************************************************
  54. // End of
  55. //***************************************************************************