summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2017-07-20 12:07:08 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2017-08-02 21:58:47 +0000
commit5c9c55906c858c1a8147e9e3fd074784bb68d645 (patch)
treec733063d7f1431a279d6d1d3b1a80ef71c37c9e4 /src/corelib/thread
parentbef7e4a2227c173a222e6cb3ac17f3161a6a24a7 (diff)
Make QThreadPoolPrivate use NSDMIs
(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 <morten.sorvig@qt.io>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qthreadpool.cpp5
-rw-r--r--src/corelib/thread/qthreadpool_p.h11
2 files changed, 6 insertions, 10 deletions
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<QPair<QRunnable *, int> > 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