Old fashion design for PC-104
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.

67 lines
1.6 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: LgWatchDog.h
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of LgWatchDog.h
  13. //----------------------------------------------------------------------------
  14. #ifndef __LG__WATCH__DOG__H__INCLUDED__
  15. #define __LG__WATCH__DOG__H__INCLUDED__
  16. #include "..\LgLib\Thread.h"
  17. #include "..\LgLib\Templ.h"
  18. class CLgWatchDog
  19. {
  20. public:
  21. CLgWatchDog();
  22. virtual ~CLgWatchDog();
  23. public:
  24. BOOL Create( LPCTSTR pCommandLine );
  25. void Destroy();
  26. public:
  27. BOOL Register( LPCTSTR pRecipientName, DWORD dwRecipientID, DWORD dwRecipientTimeout );
  28. BOOL Unregister( DWORD dwRecipientID );
  29. void Update( DWORD dwRecipientID );
  30. protected:
  31. virtual void OnTimeout( LPCTSTR pRecipientName, LPCTSTR pCommandLine ) = 0;
  32. private:
  33. typedef struct WATCHDOG_RECIPIENT
  34. {
  35. DWORD dwID;
  36. TCHAR pName[MAX_PATH];
  37. LARGE_INTEGER liTimeout;
  38. LARGE_INTEGER liTime;
  39. }WATCHDOG_RECIPIENT, *PWATCHDOG_RECIPIENT;
  40. CLgArrayP<WATCHDOG_RECIPIENT> m_RecipientArray;
  41. private:
  42. class CLgWatchDogThread : public CLgThread
  43. {
  44. public:
  45. void SetWatchDog( CLgWatchDog *pWatchDog ) { m_pWatchDog = pWatchDog; }
  46. private:
  47. virtual DWORD ThreadProc() { return m_pWatchDog->WatchDogThreadProc(); }
  48. private:
  49. CLgWatchDog *m_pWatchDog;
  50. }m_Thread;
  51. public:
  52. DWORD WatchDogThreadProc();
  53. private:
  54. TCHAR m_pCommandLine[MAX_PATH];
  55. };
  56. #endif