summaryrefslogtreecommitdiffstats
path: root/src/core/jobs/qthreadpooler_p.h
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/qthreadpooler_p.h
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/qthreadpooler_p.h')
-rw-r--r--src/core/jobs/qthreadpooler_p.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/jobs/qthreadpooler_p.h b/src/core/jobs/qthreadpooler_p.h
index 1970641b8..fafd549b2 100644
--- a/src/core/jobs/qthreadpooler_p.h
+++ b/src/core/jobs/qthreadpooler_p.h
@@ -69,10 +69,11 @@ class Q_3DCORE_PRIVATE_EXPORT QThreadPooler : public QObject
Q_OBJECT
public:
- explicit QThreadPooler(QObject *parent = 0);
+ explicit QThreadPooler(QObject *parent = nullptr);
~QThreadPooler();
QFuture<void> mapDependables(QVector<RunnableInterface *> &taskQueue);
+ int waitForAllJobs();
void taskFinished(RunnableInterface *task);
QFuture<void> future();
@@ -80,6 +81,7 @@ public:
private:
void enqueueTasks(const QVector<RunnableInterface *> &tasks);
+ void enqueueDepencies(RunnableInterface *task);
void acquire(int add);
void release();
int currentCount() const;
@@ -89,6 +91,7 @@ private:
QMutex m_mutex;
QAtomicInt m_taskCount;
QThreadPool *m_threadPool;
+ int m_totalRunJobs;
};
} // namespace Qt3DCore