summaryrefslogtreecommitdiffstats
path: root/src/core/jobs/qthreadpooler.cpp
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2023-06-09 17:08:30 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-06-09 17:08:30 +0300
commitc1f8fa2578d99e07f5e581f26bd532695b9534f9 (patch)
treef2564e0cde06e298b603e867766a6024f6ea943b /src/core/jobs/qthreadpooler.cpp
parent01aa0a9cb22ce5ed2b7ead03ed9cbeb5f978e897 (diff)
parentdc68b942aaf17338e4e74d959ab6f56b2134e1a4 (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.11' into tqtc/lts-5.15-opensourcev5.15.11-lts-lgpl
Diffstat (limited to 'src/core/jobs/qthreadpooler.cpp')
-rw-r--r--src/core/jobs/qthreadpooler.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/core/jobs/qthreadpooler.cpp b/src/core/jobs/qthreadpooler.cpp
index 59c905f71..43de400b1 100644
--- a/src/core/jobs/qthreadpooler.cpp
+++ b/src/core/jobs/qthreadpooler.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qthreadpooler_p.h"
+#include "qaspectjobmanager_p.h"
#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
@@ -49,10 +50,10 @@ QThreadPooler::QThreadPooler(QObject *parent)
, m_futureInterface(nullptr)
, m_mutex()
, m_taskCount(0)
- , m_threadPool(QThreadPool::globalInstance())
+ , m_threadPool(new QThreadPool(this))
, m_totalRunJobs(0)
{
- m_threadPool->setMaxThreadCount(QThreadPooler::maxThreadCount());
+ m_threadPool->setMaxThreadCount(QAspectJobManager::idealThreadCount());
// Ensures that threads will never be recycled
m_threadPool->setExpiryTimeout(-1);
}
@@ -199,24 +200,8 @@ int QThreadPooler::currentCount() const
return m_taskCount.loadRelaxed();
}
-int QThreadPooler::maxThreadCount()
-{
- static int threadCount = 0;
-
- if (threadCount == 0) {
- threadCount = QThread::idealThreadCount();
- const QByteArray maxThreadCount = qgetenv("QT3D_MAX_THREAD_COUNT");
- if (!maxThreadCount.isEmpty()) {
- bool conversionOK = false;
- const int maxThreadCountValue = maxThreadCount.toInt(&conversionOK);
- if (conversionOK)
- threadCount = std::min(threadCount, maxThreadCountValue);
- }
- }
-
- return threadCount;
-}
-
} // namespace Qt3DCore
QT_END_NAMESPACE
+
+#include "moc_qthreadpooler_p.cpp"