mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
refs #476 Facility to ask worker to abandon its task and finish early.
This commit is contained in:
@@ -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(); }
|
||||
|
||||
Reference in New Issue
Block a user