From 732903b2435eccf4b217d3fbcf073ab7691e0df5 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Tue, 2 Jun 2015 18:23:43 +0100 Subject: [PATCH] refs #439 Adjust noexcept specification of worker methods commonly used in destructors. --- src/blackmisc/worker.cpp | 6 +++--- src/blackmisc/worker.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/blackmisc/worker.cpp b/src/blackmisc/worker.cpp index 8ba220ba4..8280cf259 100644 --- a/src/blackmisc/worker.cpp +++ b/src/blackmisc/worker.cpp @@ -41,7 +41,7 @@ namespace BlackMisc QMetaObject::invokeMethod(this, "deleteLater"); } - void CWorkerBase::waitForFinished() + void CWorkerBase::waitForFinished() Q_DECL_NOEXCEPT { QMutex mutex; QMutexLocker waitCondLock(&mutex); @@ -75,12 +75,12 @@ namespace BlackMisc thread->start(priority); } - void CContinuousWorker::quit() + void CContinuousWorker::quit() Q_DECL_NOEXCEPT { thread()->quit(); } - void CContinuousWorker::quitAndWait() + void CContinuousWorker::quitAndWait() Q_DECL_NOEXCEPT { auto *ownThread = thread(); quit(); diff --git a/src/blackmisc/worker.h b/src/blackmisc/worker.h index 498024942..346b55a72 100644 --- a/src/blackmisc/worker.h +++ b/src/blackmisc/worker.h @@ -30,7 +30,7 @@ namespace BlackMisc Q_OBJECT public: CSingleShotController(QObject *parent) : QObject(parent), m_strongRef(QSharedPointer::create(0)) {} - ~CSingleShotController() { auto wr = weakRef(); m_strongRef.clear(); waitForNull(wr); } + ~CSingleShotController() Q_DECL_NOEXCEPT { auto wr = weakRef(); m_strongRef.clear(); waitForNull(wr); } QWeakPointer weakRef() const { return m_strongRef.toWeakRef(); } private: static void waitForNull(QWeakPointer wp) { while (wp) { QThread::msleep(10); } } @@ -82,7 +82,7 @@ namespace BlackMisc CRegularThread(QObject *parent = nullptr) : QThread(parent) {} //! Destructor - ~CRegularThread() + ~CRegularThread() Q_DECL_NOEXCEPT { quit(); wait(); @@ -166,7 +166,7 @@ namespace BlackMisc //! Blocks until the task is finished. //! \threadsafe - void waitForFinished(); + void waitForFinished() Q_DECL_NOEXCEPT; signals: //! Emitted when the task is finished. @@ -238,11 +238,11 @@ namespace BlackMisc //! Stops the thread the next time around its event loop. //! The thread and the worker will then be deleted. //! \threadsafe - void quit(); + void quit() Q_DECL_NOEXCEPT; //! Calls quit() and blocks until the thread is finished. //! \threadsafe Will deadlock if called by the worker thread. - void quitAndWait(); + void quitAndWait() Q_DECL_NOEXCEPT; protected slots: //! Called when the thread is started.