summaryrefslogtreecommitdiffstats
path: root/src/core/jobs/qthreadpooler.cpp
diff options
context:
space:
mode:
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"