From 5c9c55906c858c1a8147e9e3fd074784bb68d645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 20 Jul 2017 12:07:08 +0200 Subject: Make QThreadPoolPrivate use NSDMIs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (non static data member initializers) Also, taking the absolute value of the idealThreadCount() return value is no longer needed since the function now returns 1 for the "CPU detection failure" case. Change-Id: I2214fd15ed24413bba796ead38bbf1355dfd37d9 Reviewed-by: Morten Johan Sørvig --- src/corelib/thread/qthreadpool.cpp | 5 ----- src/corelib/thread/qthreadpool_p.h | 11 ++++++----- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index f3ce1f258f..71310b0ebf 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -154,11 +154,6 @@ void QThreadPoolThread::registerThreadInactive() \internal */ QThreadPoolPrivate:: QThreadPoolPrivate() - : isExiting(false), - expiryTimeout(30000), - maxThreadCount(qAbs(QThread::idealThreadCount())), - reservedThreads(0), - activeThreads(0) { } bool QThreadPoolPrivate::tryStart(QRunnable *task) diff --git a/src/corelib/thread/qthreadpool_p.h b/src/corelib/thread/qthreadpool_p.h index 4a9f9e5cfa..0eff69d440 100644 --- a/src/corelib/thread/qthreadpool_p.h +++ b/src/corelib/thread/qthreadpool_p.h @@ -53,6 +53,7 @@ // #include "QtCore/qmutex.h" +#include "QtCore/qthread.h" #include "QtCore/qwaitcondition.h" #include "QtCore/qset.h" #include "QtCore/qqueue.h" @@ -91,11 +92,11 @@ public: QVector > queue; QWaitCondition noActiveThreads; - bool isExiting; - int expiryTimeout; - int maxThreadCount; - int reservedThreads; - int activeThreads; + int expiryTimeout = 30000; + int maxThreadCount = QThread::idealThreadCount(); + int reservedThreads = 0; + int activeThreads = 0; + bool isExiting = false; }; QT_END_NAMESPACE -- cgit v1.2.3