Limit gui thread pool to 8 threads
Avoid having too many threads, since iOS punishes us if we overstep 64, and we don't really need more than 8 on any platform. Fixes: QTBUG-128290 Pick-to: 6.7 6.5 Change-Id: I59a233d422e9b1b2097a777e0b1b626e144594d9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 80f210db3e43c50e252504f41ed3fbd8b2992028) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
13dbf7542e
commit
5c2796a079
@ -481,8 +481,13 @@ QThreadPool *QThreadPoolPrivate::qtGuiInstance()
|
||||
Q_CONSTINIT static QBasicMutex theMutex;
|
||||
|
||||
const QMutexLocker locker(&theMutex);
|
||||
if (guiInstance.isNull() && !QCoreApplication::closingDown())
|
||||
if (guiInstance.isNull() && !QCoreApplication::closingDown()) {
|
||||
guiInstance = new QThreadPool();
|
||||
// Limit max thread to avoid too many parallel threads.
|
||||
// We are not optimized for much more than 4 or 8 threads.
|
||||
if (guiInstance && guiInstance->maxThreadCount() > 4)
|
||||
guiInstance->setMaxThreadCount(qBound(4, guiInstance->maxThreadCount() / 2, 8));
|
||||
}
|
||||
return guiInstance;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user