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>
This commit is contained in:
Morten Johan Sørvig 2017-07-20 12:07:08 +02:00
parent bef7e4a222
commit 5c9c55906c
2 changed files with 6 additions and 10 deletions

View File

@ -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)

View File

@ -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