Commit e348d6556eed6e8888a270cbca100d8dbc0ef2ad

  • avatar
  • Sergey 'Jin' Bostandzhyan <jin @deve…per.digitalstrom.org>
  • Mon Aug 02 20:05:47 CEST 2010
Improved shutdown procedure

It turned out to be problematic to shut down inmid the initialization
procedure. Made sure that we wait till all subsystems and modules get
initialized and shutdown immediately after that.
core/dss.cpp
(19 / 7)
  
9494
9595 DSS::DSS()
9696 {
97 m_ShutdownFlag = false;
9798 m_State = ssInvalid;
9899 m_pPropertySystem = boost::shared_ptr<PropertySystem>(new PropertySystem);
99100 setupDirectories();
405405
406406 m_State = ssRunning;
407407
408 // pass control to the eventrunner
409 m_pEventRunner->run();
408 if (!m_ShutdownFlag) {
409 // pass control to the eventrunner
410 m_pEventRunner->run();
411 }
410412
413 m_State = ssTerminating;
414
415 std::for_each(m_Subsystems.begin(), m_Subsystems.end(), StopSubsystem);
416 m_pEventQueue->shutdown();
417 m_pEventInterpreter->terminate();
418
411419 // shutdown all subsystems and services
412420#ifdef WITH_BONJOUR
413421 bonjour.quit();
414422 bonjour.terminate();
415423#endif
416424
417 m_State = ssTerminating;
418425
419 std::for_each(m_Subsystems.begin(), m_Subsystems.end(), StopSubsystem);
420 m_pEventQueue->shutdown();
421 m_pEventInterpreter->terminate();
422426 } // run
423427
424428 void DSS::initiateShutdown() {
425 m_pEventRunner->shutdown();
429 m_ShutdownFlag = true;
430 if (m_State != ssRunning) {
431 return;
432 }
433
434 if (m_pEventRunner != NULL) {
435 m_pEventRunner->shutdown();
436 }
426437 }
427438
428439 void DSS::shutdown() {
core/dss.h
(1 / 0)
  
8989 std::string m_jsLogDirectory;
9090
9191 aDSSState m_State;
92 bool m_ShutdownFlag;
9293
9394 /// Private constructor for singleton
9495 DSS();