TestWorker.cpp 477 B

12345678910111213141516171819202122232425262728293031
  1. #include "StdAfx.h"
  2. #include "TestWorker.h"
  3. CTestWorker::CTestWorker(void):m_isBusy(false),m_task(0)
  4. {
  5. }
  6. CTestWorker::~CTestWorker(void)
  7. {
  8. }
  9. ServiceState CTestWorker::OnRunning( void )
  10. {
  11. ServiceState nextState = IService::OnRunning();
  12. if(nextState == pausing) return nextState;
  13. if(m_isBusy){
  14. m_task->run();
  15. m_isBusy=false;
  16. }else{
  17. Sleep(10);
  18. }
  19. return IService::OnRunning();
  20. }
  21. ServiceState CTestWorker::OnStarting( void )
  22. {
  23. m_isBusy=false;
  24. return running;
  25. }