mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +08:00
refs #801, shutdown flag in runtime
(can be used to skip functions/tasks no longer make sense during shutdown)
This commit is contained in:
@@ -52,7 +52,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CCoreFacade::init(const CCoreFacadeConfig &config)
|
void CCoreFacade::init(const CCoreFacadeConfig &config)
|
||||||
{
|
{
|
||||||
if (m_init) { return; }
|
if (m_initalized || m_shuttingDown) { return; }
|
||||||
|
|
||||||
QMap<QString, int> times;
|
QMap<QString, int> times;
|
||||||
QTime time;
|
QTime time;
|
||||||
@@ -116,7 +116,7 @@ namespace BlackCore
|
|||||||
CLogMessage(this).info("Init times: %1") << qmapToString(times);
|
CLogMessage(this).info("Init times: %1") << qmapToString(times);
|
||||||
|
|
||||||
// flag
|
// flag
|
||||||
m_init = true;
|
m_initalized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCoreFacade::hasRemoteApplicationContext() const
|
bool CCoreFacade::hasRemoteApplicationContext() const
|
||||||
@@ -227,8 +227,9 @@ namespace BlackCore
|
|||||||
|
|
||||||
void CCoreFacade::gracefulShutdown()
|
void CCoreFacade::gracefulShutdown()
|
||||||
{
|
{
|
||||||
if (!this->m_init) return;
|
if (!this->m_initalized) { return; }
|
||||||
this->m_init = false;
|
if (m_shuttingDown) { return; }
|
||||||
|
this->m_shuttingDown = true;
|
||||||
|
|
||||||
// disable all signals towards runtime
|
// disable all signals towards runtime
|
||||||
disconnect(this);
|
disconnect(this);
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* The runtime class providing facades (the contexts) for all DBus relevant operations.
|
* The class providing facades (the contexts) for all DBus relevant operations.
|
||||||
* - Initializes all contexts in correct order
|
* - It initializes all contexts in correct order
|
||||||
* - Allows a ordered and correct shutdown
|
* - Allows an ordered and correct shutdown
|
||||||
* - Connects all signal/slots between contexts
|
* - Connects all signal/slots between contexts
|
||||||
* (such cross context dependencies are not desired but sometimes required)
|
* (such cross context dependencies are not desired but sometimes required)
|
||||||
* - Loads the application settings
|
* - Loads the application settings
|
||||||
@@ -72,6 +72,9 @@ namespace BlackCore
|
|||||||
//! Clean up (will be connected to signal QCoreApplication::aboutToQuit)
|
//! Clean up (will be connected to signal QCoreApplication::aboutToQuit)
|
||||||
void gracefulShutdown();
|
void gracefulShutdown();
|
||||||
|
|
||||||
|
//! Facade and context shutting down
|
||||||
|
bool isShuttingDown() const { return m_shuttingDown; }
|
||||||
|
|
||||||
// ------- Context as interface, normal way to access a context
|
// ------- Context as interface, normal way to access a context
|
||||||
|
|
||||||
//! Context for network
|
//! Context for network
|
||||||
@@ -160,7 +163,8 @@ namespace BlackCore
|
|||||||
bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator);
|
bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_init = false; //!< flag
|
bool m_initalized = false; //!< flag if already initialized
|
||||||
|
bool m_shuttingDown = false; //!< flag if shutting down
|
||||||
BlackMisc::CSetting<Application::TDBusServerAddress> m_dbusServerAddress { this };
|
BlackMisc::CSetting<Application::TDBusServerAddress> m_dbusServerAddress { this };
|
||||||
|
|
||||||
// DBus
|
// DBus
|
||||||
|
|||||||
Reference in New Issue
Block a user