summaryrefslogtreecommitdiffstats
path: root/src/core/jobs/task.cpp
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2020-02-13 13:38:37 +0000
committerMike Krus <mike.krus@kdab.com>2020-02-14 07:03:06 +0000
commit92ac289664d50d2905be528c98fc82ecf6e2fcd1 (patch)
tree65e8fb8056da621831498bf61f1399f0c6f7ae48 /src/core/jobs/task.cpp
parent6aef82519bdc538c2fee67047bd990485715c721 (diff)
Add flag to jobs to indicate if they need to run or not
Once aspect jobs are inserted in the queue, they will always run, but some of them don't actually have anything to do at every frame. Ideally, when building a graph of jobs, you would include only jobs that are required. However this makes building the graph more complicated. This introduces a method on the private job pimple which indicated if the job actually has something to do or not. When the scheduler is ready to run a job, it will call that method. If there's nothing to do, then the job will be skipped and the dependent jobs (if any) run instead. Change-Id: Iaa8d3d064f03d8c0bab407879a9acea292a06784 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/core/jobs/task.cpp')
-rw-r--r--src/core/jobs/task.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/jobs/task.cpp b/src/core/jobs/task.cpp
index 1dd5712c9..f5bfae014 100644
--- a/src/core/jobs/task.cpp
+++ b/src/core/jobs/task.cpp
@@ -68,6 +68,11 @@ AspectTaskRunnable::~AspectTaskRunnable()
{
}
+bool AspectTaskRunnable::isRequired()
+{
+ return m_job ? QAspectJobPrivate::get(m_job.data())->isRequired() : false;
+}
+
void AspectTaskRunnable::run()
{
if (m_job) {
@@ -100,6 +105,11 @@ SyncTaskRunnable::~SyncTaskRunnable()
{
}
+bool SyncTaskRunnable::isRequired()
+{
+ return true;
+}
+
void SyncTaskRunnable::run()
{
// Call the function