summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2020-03-04 08:57:58 +0000
committerMike Krus <mike.krus@kdab.com>2020-03-04 08:58:08 +0000
commit037d833f7d99e5cf8a92595acf633356f8d663d7 (patch)
tree69b619ae7bc77ce5dc5d0c895ab4607a262abc25 /src/core
parent418fa3e3ed35b97e78ad1978bbc3653b4dc9763d (diff)
parentfd520c2b9e3c57e4f63c60e6fe27af00b7b427c4 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'src/core')
-rw-r--r--src/core/jobs/qthreadpooler.cpp24
-rw-r--r--src/core/jobs/qthreadpooler_p.h1
2 files changed, 20 insertions, 5 deletions
diff --git a/src/core/jobs/qthreadpooler.cpp b/src/core/jobs/qthreadpooler.cpp
index 621881597..f1c2883dc 100644
--- a/src/core/jobs/qthreadpooler.cpp
+++ b/src/core/jobs/qthreadpooler.cpp
@@ -92,15 +92,31 @@ void QThreadPooler::enqueueTasks(const QVector<RunnableInterface *> &tasks)
(*it)->setPooler(this);
m_threadPool->start((*it));
} else {
- release();
- enqueueDepencies(*it);
+ skipTask(*it);
}
}
}
}
+void QThreadPooler::skipTask(RunnableInterface *task)
+{
+ enqueueDepencies(task);
+
+ if (currentCount() == 0) {
+ if (m_futureInterface) {
+ m_futureInterface->reportFinished();
+ delete m_futureInterface;
+ }
+ m_futureInterface = nullptr;
+ }
+
+ delete task; // normally gets deleted by threadpool
+}
+
void QThreadPooler::enqueueDepencies(RunnableInterface *task)
{
+ release();
+
if (task->type() == RunnableInterface::RunnableType::AspectTask) {
AspectTaskRunnable *aspectTask = static_cast<AspectTaskRunnable *>(task);
const auto &dependers = aspectTask->m_dependers;
@@ -113,8 +129,7 @@ void QThreadPooler::enqueueDepencies(RunnableInterface *task)
dependerTask->setPooler(this);
m_threadPool->start(dependerTask);
} else {
- release();
- enqueueDepencies(*it);
+ skipTask(*it);
}
}
}
@@ -126,7 +141,6 @@ void QThreadPooler::taskFinished(RunnableInterface *task)
{
const QMutexLocker locker(&m_mutex);
- release();
m_totalRunJobs++;
enqueueDepencies(task);
diff --git a/src/core/jobs/qthreadpooler_p.h b/src/core/jobs/qthreadpooler_p.h
index fafd549b2..43a67033e 100644
--- a/src/core/jobs/qthreadpooler_p.h
+++ b/src/core/jobs/qthreadpooler_p.h
@@ -81,6 +81,7 @@ public:
private:
void enqueueTasks(const QVector<RunnableInterface *> &tasks);
+ void skipTask(RunnableInterface *task);
void enqueueDepencies(RunnableInterface *task);
void acquire(int add);
void release();