refs #452, allow to "shutdown" threaded reader

This commit is contained in:
Klaus Basan
2015-09-23 15:02:32 +02:00
committed by Mathew Sutcliffe
parent 567cead20d
commit fc2982c7c3
2 changed files with 12 additions and 1 deletions

View File

@@ -34,6 +34,12 @@ namespace BlackMisc
QMetaObject::invokeMethod(m_updateTimer, "stop");
}
void CThreadedReader::gracefulShutdown()
{
this->m_shutdown = true;
this->requestStop();
}
CThreadedReader::~CThreadedReader()
{
cleanup();

View File

@@ -54,11 +54,16 @@ namespace BlackMisc
//! \threadsafe
int interval() const;
//! Graceful shutdown
void gracefulShutdown();
protected:
//! Constructor
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
//! Make sure everthing runs correctly in own thread