From c1f4286a5cbc1794fe7be5bdbbd6a0bf29ef84d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 12 Dec 2018 10:00:05 +0100 Subject: Wasm: Implement QThread::idealThreadCount() Read the navigator.hardwareConcurrency property. Task-number: QTBUG-64625 Change-Id: I2ad582b67e4b0ddac3e3c21febab55543b2e1d6d Reviewed-by: Lorn Potter --- src/corelib/thread/qthread_unix.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 329caa02ba..a13f8ca215 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -100,6 +100,9 @@ #include #endif +#if defined(Q_OS_WASM) +#include +#endif QT_BEGIN_NAMESPACE @@ -499,6 +502,8 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW // as of aug 2008 VxWorks < 6.6 only supports one single core CPU cores = 1; # endif +#elif defined(Q_OS_WASM) + cores = emscripten::val::global("navigator")["hardwareConcurrency"].as(); #else // the rest: Linux, Solaris, AIX, Tru64 cores = (int)sysconf(_SC_NPROCESSORS_ONLN); -- cgit v1.2.3