mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
refs #624 Use noexcept instead of Q_DECL_NOEXCEPT.
This commit is contained in:
@@ -45,7 +45,7 @@ namespace BlackMisc
|
||||
*/
|
||||
//! @{
|
||||
template <class T>
|
||||
constexpr typename std::add_const<T>::type &as_const(T &v) Q_DECL_NOEXCEPT { return v; }
|
||||
constexpr typename std::add_const<T>::type &as_const(T &v) noexcept { return v; }
|
||||
template <class T>
|
||||
void as_const(const T &&) = delete;
|
||||
//! @}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace BlackMisc
|
||||
this->m_temp = other.m_temp;
|
||||
}
|
||||
|
||||
const char *CStatusException::what() const Q_DECL_NOEXCEPT
|
||||
const char *CStatusException::what() const noexcept
|
||||
{
|
||||
QWriteLocker lock(&this->m_lock);
|
||||
if (m_temp.isNull()) { m_temp = m_payload.getMessage().toLocal8Bit(); }
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BlackMisc
|
||||
CStatusException &operator=(const CStatusException &) = delete;
|
||||
|
||||
//! Return null-terminated message string.
|
||||
virtual const char *what() const Q_DECL_NOEXCEPT override;
|
||||
virtual const char *what() const noexcept override;
|
||||
|
||||
//! Return the contained status message.
|
||||
const CStatusMessage &status() const { return m_payload; }
|
||||
|
||||
@@ -45,20 +45,20 @@ namespace BlackMisc
|
||||
QMetaObject::invokeMethod(this, "deleteLater");
|
||||
}
|
||||
|
||||
void CWorkerBase::waitForFinished() Q_DECL_NOEXCEPT
|
||||
void CWorkerBase::waitForFinished() noexcept
|
||||
{
|
||||
std::promise<void> promise;
|
||||
then([ & ] { promise.set_value(); });
|
||||
promise.get_future().wait();
|
||||
}
|
||||
|
||||
void CWorkerBase::abandon() Q_DECL_NOEXCEPT
|
||||
void CWorkerBase::abandon() noexcept
|
||||
{
|
||||
thread()->requestInterruption();
|
||||
quit();
|
||||
}
|
||||
|
||||
void CWorkerBase::abandonAndWait() Q_DECL_NOEXCEPT
|
||||
void CWorkerBase::abandonAndWait() noexcept
|
||||
{
|
||||
thread()->requestInterruption();
|
||||
quitAndWait();
|
||||
@@ -90,13 +90,13 @@ namespace BlackMisc
|
||||
thread->start(priority);
|
||||
}
|
||||
|
||||
void CContinuousWorker::quit() Q_DECL_NOEXCEPT
|
||||
void CContinuousWorker::quit() noexcept
|
||||
{
|
||||
Q_ASSERT_X(!CThreadUtils::isApplicationThreadObjectThread(this), Q_FUNC_INFO, "Try to stop main thread");
|
||||
thread()->quit();
|
||||
}
|
||||
|
||||
void CContinuousWorker::quitAndWait() Q_DECL_NOEXCEPT
|
||||
void CContinuousWorker::quitAndWait() noexcept
|
||||
{
|
||||
Q_ASSERT_X(!CThreadUtils::isApplicationThreadObjectThread(this), Q_FUNC_INFO, "Try to stop main thread");
|
||||
auto *ownThread = thread();
|
||||
|
||||
@@ -159,14 +159,14 @@ namespace BlackMisc
|
||||
|
||||
//! Blocks until the task is finished.
|
||||
//! \threadsafe Will deadlock if called by the worker thread.
|
||||
void waitForFinished() Q_DECL_NOEXCEPT;
|
||||
void waitForFinished() noexcept;
|
||||
|
||||
//! Notify the task that its result is no longer needed, so it can finish early.
|
||||
//! \threadsafe
|
||||
void abandon() Q_DECL_NOEXCEPT;
|
||||
void abandon() noexcept;
|
||||
|
||||
//! Convenience to call abandon() followed by waitForFinished().
|
||||
void abandonAndWait() Q_DECL_NOEXCEPT;
|
||||
void abandonAndWait() noexcept;
|
||||
|
||||
signals:
|
||||
//! Emitted when the task is finished.
|
||||
@@ -200,8 +200,8 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void quit() Q_DECL_NOEXCEPT {}
|
||||
virtual void quitAndWait() Q_DECL_NOEXCEPT { waitForFinished(); }
|
||||
virtual void quit() noexcept {}
|
||||
virtual void quitAndWait() noexcept { waitForFinished(); }
|
||||
|
||||
bool m_finished = false;
|
||||
mutable QMutex m_finishedMutex { QMutex::Recursive };
|
||||
@@ -293,11 +293,11 @@ namespace BlackMisc
|
||||
//! Stops the thread the next time around its event loop.
|
||||
//! The thread and the worker will then be deleted.
|
||||
//! \threadsafe
|
||||
virtual void quit() Q_DECL_NOEXCEPT final override;
|
||||
virtual void quit() noexcept final override;
|
||||
|
||||
//! Calls quit() and blocks until the thread is finished.
|
||||
//! \threadsafe Will deadlock if called by the worker thread.
|
||||
virtual void quitAndWait() Q_DECL_NOEXCEPT final override;
|
||||
virtual void quitAndWait() noexcept final override;
|
||||
|
||||
protected slots:
|
||||
//! Called when the thread is started.
|
||||
|
||||
Reference in New Issue
Block a user