refs #476 Facility to ask worker to abandon its task and finish early.

This commit is contained in:
Mathew Sutcliffe
2015-11-25 20:31:10 +00:00
parent ff1272e1b8
commit 1dc4864ffa
2 changed files with 36 additions and 3 deletions

View File

@@ -51,6 +51,23 @@ namespace BlackMisc
promise.get_future().wait();
}
void CWorkerBase::abandon() Q_DECL_NOEXCEPT
{
thread()->requestInterruption();
quit();
}
void CWorkerBase::abandonAndWait() Q_DECL_NOEXCEPT
{
thread()->requestInterruption();
quitAndWait();
}
bool CWorkerBase::isAbandoned() const
{
return thread()->isInterruptionRequested();
}
void CContinuousWorker::start(QThread::Priority priority)
{
if (m_name.isEmpty()) { m_name = metaObject()->className(); }