T66 A new smart pointer for managing a CContinuousWorker subclass instance.

Owns the worker before it starts, when ownership is transferred to the thread.
This commit is contained in:
Mathew Sutcliffe
2017-05-06 23:46:53 +01:00
parent ca81c65eae
commit 41ff563e19
4 changed files with 70 additions and 8 deletions

View File

@@ -56,6 +56,7 @@ namespace BlackMisc
CWorker *CWorker::fromTaskImpl(QObject *owner, const QString &name, int typeId, std::function<CVariant()> task)
{
auto *worker = new CWorker(task);
emit worker->aboutToStart();
worker->setStarted();
auto *thread = new CRegularThread(owner);
@@ -122,6 +123,7 @@ namespace BlackMisc
if (m_name.isEmpty()) { m_name = metaObject()->className(); }
emit aboutToStart();
setStarted();
auto *thread = new CRegularThread(m_owner);