summaryrefslogtreecommitdiffstats
path: root/src/core/jobs
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-07 03:03:08 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-07 03:03:09 +0100
commit4505f5acbc346a0cea6ccf5e7d02c75c6e3ca4cb (patch)
treeeeee8e91d896bd35cce2fe8d3051862e40585f44 /src/core/jobs
parent3d1063fce2ada72d740f5f7c7888533da8794753 (diff)
parent3019497559328d2fd0c0c9548f512fba9fe1f94e (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'src/core/jobs')
-rw-r--r--src/core/jobs/qthreadpooler.cpp13
-rw-r--r--src/core/jobs/qthreadpooler_p.h2
2 files changed, 9 insertions, 6 deletions
diff --git a/src/core/jobs/qthreadpooler.cpp b/src/core/jobs/qthreadpooler.cpp
index a9f4e7a31..3ab321542 100644
--- a/src/core/jobs/qthreadpooler.cpp
+++ b/src/core/jobs/qthreadpooler.cpp
@@ -66,16 +66,19 @@ QThreadPooler::QThreadPooler(QObject *parent)
, m_futureInterface(nullptr)
, m_mutex()
, m_taskCount(0)
+ , m_threadPool(QThreadPool::globalInstance())
{
const QByteArray maxThreadCount = qgetenv("QT3D_MAX_THREAD_COUNT");
if (!maxThreadCount.isEmpty()) {
bool conversionOK = false;
const int maxThreadCountValue = maxThreadCount.toInt(&conversionOK);
if (conversionOK)
- m_threadPool.setMaxThreadCount(maxThreadCountValue);
+ m_threadPool->setMaxThreadCount(maxThreadCountValue);
}
+
+
// Ensures that threads will never be recycled
- m_threadPool.setExpiryTimeout(-1);
+ m_threadPool->setExpiryTimeout(-1);
#if QT_CONFIG(qt3d_profile_jobs)
QThreadPooler::m_jobsStatTimer.start();
#endif
@@ -105,7 +108,7 @@ void QThreadPooler::enqueueTasks(const QVector<RunnableInterface *> &tasks)
if (!hasDependencies(*it) && !(*it)->reserved()) {
(*it)->setReserved(true);
(*it)->setPooler(this);
- m_threadPool.start((*it));
+ m_threadPool->start((*it));
}
}
}
@@ -125,7 +128,7 @@ void QThreadPooler::taskFinished(RunnableInterface *task)
if (!aspectTask->reserved()) {
aspectTask->setReserved(true);
aspectTask->setPooler(this);
- m_threadPool.start(aspectTask);
+ m_threadPool->start(aspectTask);
}
}
}
@@ -188,7 +191,7 @@ int QThreadPooler::currentCount() const
int QThreadPooler::maxThreadCount() const
{
- return m_threadPool.maxThreadCount();
+ return m_threadPool->maxThreadCount();
}
#if QT_CONFIG(qt3d_profile_jobs)
diff --git a/src/core/jobs/qthreadpooler_p.h b/src/core/jobs/qthreadpooler_p.h
index 65459efba..3e17cbd6d 100644
--- a/src/core/jobs/qthreadpooler_p.h
+++ b/src/core/jobs/qthreadpooler_p.h
@@ -103,7 +103,7 @@ private:
QFutureInterface<void> *m_futureInterface;
QMutex m_mutex;
QAtomicInt m_taskCount;
- QThreadPool m_threadPool;
+ QThreadPool *m_threadPool;
};
} // namespace Qt3DCore