diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2015-10-23 11:11:59 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2015-10-24 16:36:31 +0000 |
commit | fee0c31d0864c49814b740d34bf5f35b21aea795 (patch) | |
tree | 78267e2e39b75d2835da1579ef8a4a47c3d2dcf7 /src/core/jobs/qthreadpooler.cpp | |
parent | 25990ea51fd00ae6ea62dd5ec0f03d5d9a1427f7 (diff) |
QThreadPooler: use a private ThreadPool
as anyone could modify the expiry timeout on the global instance of the
QThreadPool
Change-Id: I5114273f799b95f8237f580d8e18133769052ff6
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/core/jobs/qthreadpooler.cpp')
-rw-r--r-- | src/core/jobs/qthreadpooler.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/jobs/qthreadpooler.cpp b/src/core/jobs/qthreadpooler.cpp index 94d5c04a4..7a315884b 100644 --- a/src/core/jobs/qthreadpooler.cpp +++ b/src/core/jobs/qthreadpooler.cpp @@ -37,7 +37,6 @@ #include "qthreadpooler_p.h" #include "dependencyhandler_p.h" -#include <QtCore/QThreadPool> #include <QDebug> QT_BEGIN_NAMESPACE @@ -54,7 +53,8 @@ QThreadPooler::QThreadPooler(QObject *parent) m_mutex(new QMutex(QMutex::NonRecursive)), m_taskCount(0) { - QThreadPool::globalInstance()->setExpiryTimeout(-1); + // Ensures that threads will never be recycled + m_threadPool.setExpiryTimeout(-1); } QThreadPooler::~QThreadPooler() @@ -81,7 +81,7 @@ void QThreadPooler::enqueueTasks(QVector<RunnableInterface *> &tasks) if (!m_dependencyHandler->hasDependency((*it)) && !(*it)->reserved()) { (*it)->setReserved(true); (*it)->setPooler(this); - QThreadPool::globalInstance()->start((*it)); + m_threadPool.start((*it)); } } } @@ -167,7 +167,7 @@ int QThreadPooler::currentCount() int QThreadPooler::maxThreadCount() const { - return QThreadPool::globalInstance()->maxThreadCount(); + return m_threadPool.maxThreadCount(); } } // namespace Qt3DCore |