wasm: hardcode idealThreadCount for some browsers
Browsers like Safari do not support the hardwareConcurrency property. Will hard code it to 2, as iOS only supports that amount. Pick-to: 6.3 6.2 Change-Id: Icb35d3b698b28d8191a554167dc8cc262b806fb2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
2c3198ab5f
commit
be5508fad0
@ -788,7 +788,11 @@ void QCoreApplicationPrivate::init()
|
||||
|
||||
#if QT_CONFIG(thread)
|
||||
#ifdef Q_OS_WASM
|
||||
QThreadPrivate::idealThreadCount = emscripten::val::global("navigator")["hardwareConcurrency"].as<int>();
|
||||
emscripten::val hardwareConcurrency = emscripten::val::global("navigator")["hardwareConcurrency"];
|
||||
if (hardwareConcurrency.isUndefined())
|
||||
QThreadPrivate::idealThreadCount = 2;
|
||||
else
|
||||
QThreadPrivate::idealThreadCount = hardwareConcurrency.as<int>();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user