mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 10:45:37 +08:00
refs #452, allow to "shutdown" threaded reader
This commit is contained in:
committed by
Mathew Sutcliffe
parent
567cead20d
commit
fc2982c7c3
@@ -34,6 +34,12 @@ namespace BlackMisc
|
|||||||
QMetaObject::invokeMethod(m_updateTimer, "stop");
|
QMetaObject::invokeMethod(m_updateTimer, "stop");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CThreadedReader::gracefulShutdown()
|
||||||
|
{
|
||||||
|
this->m_shutdown = true;
|
||||||
|
this->requestStop();
|
||||||
|
}
|
||||||
|
|
||||||
CThreadedReader::~CThreadedReader()
|
CThreadedReader::~CThreadedReader()
|
||||||
{
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|||||||
@@ -54,11 +54,16 @@ namespace BlackMisc
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
int interval() const;
|
int interval() const;
|
||||||
|
|
||||||
|
//! Graceful shutdown
|
||||||
|
void gracefulShutdown();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CThreadedReader(QObject *owner, const QString &name);
|
CThreadedReader(QObject *owner, const QString &name);
|
||||||
|
|
||||||
QTimer *m_updateTimer = nullptr; //!< update timer
|
QTimer *m_updateTimer = nullptr; //!< update timer
|
||||||
|
bool m_shutdown = false; //!< in shutdown process
|
||||||
|
|
||||||
mutable QReadWriteLock m_lock {QReadWriteLock::Recursive}; //!< lock
|
mutable QReadWriteLock m_lock {QReadWriteLock::Recursive}; //!< lock
|
||||||
|
|
||||||
//! Make sure everthing runs correctly in own thread
|
//! Make sure everthing runs correctly in own thread
|
||||||
|
|||||||
Reference in New Issue
Block a user