mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
T66 Tidying up CBackgroundDataUpdater startup and shutdown
by overriding the CContinuousWorker virtual methods that exist for this purpose.
This commit is contained in:
@@ -37,9 +37,20 @@ namespace BlackCore
|
||||
CContinuousWorker(owner, "Background data updater")
|
||||
{
|
||||
connect(&m_updateTimer, &QTimer::timeout, this, &CBackgroundDataUpdater::doWork);
|
||||
}
|
||||
|
||||
void CBackgroundDataUpdater::initialize()
|
||||
{
|
||||
m_updateTimer.start(60 * 1000);
|
||||
}
|
||||
|
||||
void CBackgroundDataUpdater::cleanup()
|
||||
{
|
||||
m_updateTimer.stop();
|
||||
m_shutdown = true;
|
||||
m_enabled = false;
|
||||
}
|
||||
|
||||
CBackgroundDataUpdater::~CBackgroundDataUpdater()
|
||||
{
|
||||
gracefulShutdown();
|
||||
@@ -60,18 +71,12 @@ namespace BlackCore
|
||||
|
||||
void CBackgroundDataUpdater::gracefulShutdown()
|
||||
{
|
||||
if (m_shutdown) { return; }
|
||||
m_shutdown = true;
|
||||
m_enabled = false;
|
||||
if (!CThreadUtils::isCurrentThreadObjectThread(this))
|
||||
{
|
||||
this->abandonAndWait();
|
||||
}
|
||||
else
|
||||
{
|
||||
// timer needs to be stopped in its own thread
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
void CBackgroundDataUpdater::startUpdating(int updateTimeSecs)
|
||||
|
||||
Reference in New Issue
Block a user