Notify_Thread.cpp 953 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "Notify_Thread.h"
  2. #include "ResDataObject.h"
  3. #include "common_api.h"
  4. #include "LogLocalHelper.h" // 模块名接口声明(共用)
  5. #include "Log4CPP.h"
  6. //extern Log4CPP::Logger* mLog::gLogger;
  7. Notify_Thread::Notify_Thread()
  8. {
  9. m_pDPC = NULL;
  10. }
  11. Notify_Thread::~Notify_Thread()
  12. {
  13. }
  14. bool Notify_Thread::Exec()
  15. {
  16. //check exit flag
  17. if (WaitTheThreadEndSign(0) == true)
  18. {
  19. return false;
  20. }
  21. //FERROR("Drv NotifyT Entry");
  22. if (CheckForPause())
  23. {
  24. FERROR("Got Pause Evt.Wait Resume");
  25. if (WaitforResume() == false)
  26. {
  27. FERROR("Failed Wait Resume Evt.Exit Thread");
  28. return false;
  29. }
  30. FERROR("Got Resume Evt.Go Normal");
  31. }
  32. //dpc work
  33. if (m_pDPC)
  34. {
  35. std::vector<std::shared_ptr<LinuxEvent>> wait = { m_ExitFlag, m_PauseEvt };
  36. if (m_pDPC->OnNotify(wait,2) == 0)
  37. {
  38. FERROR("OnNotify return False");
  39. return false;
  40. }
  41. return true;
  42. }
  43. return false;
  44. }
  45. void Notify_Thread::SetDPC(DriverDPC *pDPC)
  46. {
  47. m_pDPC = pDPC;
  48. }