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(+) (limited to 'src/corelib/thread') 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 From b611eb81c822ed2bcd3107ba098b56952ae0685c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 5 Feb 2019 11:43:04 +0100 Subject: Fix QDeadlineTimer::Forever case in QWaitCondition The timeout will never be larger than numeric_limits::max(), especially on platforms with 32-bit longs. Instead, test if the timeout is exactly numeric_limits::max(), which matches the ULONG_MAX value which is documented to indicate no timeout. Change-Id: Ib663eddb5703797c50c04fd4eae60bd64f379d1c Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne --- src/corelib/thread/qwaitcondition_unix.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qwaitcondition_unix.cpp b/src/corelib/thread/qwaitcondition_unix.cpp index c93328b4bc..0ba90763cf 100644 --- a/src/corelib/thread/qwaitcondition_unix.cpp +++ b/src/corelib/thread/qwaitcondition_unix.cpp @@ -204,7 +204,7 @@ void QWaitCondition::wakeAll() bool QWaitCondition::wait(QMutex *mutex, unsigned long time) { - if (quint64(time) > quint64(std::numeric_limits::max())) + if (time == std::numeric_limits::max()) return wait(mutex, QDeadlineTimer(QDeadlineTimer::Forever)); return wait(mutex, QDeadlineTimer(time)); } @@ -231,6 +231,8 @@ bool QWaitCondition::wait(QMutex *mutex, QDeadlineTimer deadline) bool QWaitCondition::wait(QReadWriteLock *readWriteLock, unsigned long time) { + if (time == std::numeric_limits::max()) + return wait(readWriteLock, QDeadlineTimer(QDeadlineTimer::Forever)); return wait(readWriteLock, QDeadlineTimer(time)); } -- cgit v1.2.3 From 5993bea032936bd3c913290249eb5b60f819818d Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 6 Feb 2019 07:54:33 +0100 Subject: Fix: "Missing emit keyword on signal call" [-Wclazy-incorrect-emit] Change-Id: I32cf5db522dcb14bbe5151914624979929eeb52e Reviewed-by: Tim Jenssen --- src/corelib/thread/qfuturewatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qfuturewatcher.cpp b/src/corelib/thread/qfuturewatcher.cpp index faeb6b3a28..4ee7693ace 100644 --- a/src/corelib/thread/qfuturewatcher.cpp +++ b/src/corelib/thread/qfuturewatcher.cpp @@ -479,7 +479,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event) emit q->progressValueChanged(event->index1); if (!event->text.isNull()) // ### - q->progressTextChanged(event->text); + emit q->progressTextChanged(event->text); break; case QFutureCallOutEvent::ProgressRange: emit q->progressRangeChanged(event->index1, event->index2); -- cgit v1.2.3 From 91deac4a65a31141764cd2739066166475f024d8 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 15 Feb 2019 21:21:20 +0100 Subject: QtCore: replace null and nullptr with \nullptr in documentation Replace null and '\c nullptr' with \nullptr in the documentation. Change-Id: Ib9e0cfc2eb2830b213e6523773603d56180b0998 Reviewed-by: Friedemann Kleint --- src/corelib/thread/qsemaphore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/thread') diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp index aa04fb10ff..2e0b6f2bc0 100644 --- a/src/corelib/thread/qsemaphore.cpp +++ b/src/corelib/thread/qsemaphore.cpp @@ -606,7 +606,7 @@ bool QSemaphore::tryAcquire(int n, int timeout) \fn QSemaphoreReleaser::semaphore() const Returns a pointer to the QSemaphore object provided to the constructor, - or by the last move assignment, if any. Otherwise, returns \c nullptr. + or by the last move assignment, if any. Otherwise, returns \nullptr. */ /*! @@ -614,7 +614,7 @@ bool QSemaphore::tryAcquire(int n, int timeout) Cancels this QSemaphoreReleaser such that the destructor will no longer call \c{semaphore()->release()}. Returns the value of semaphore() - before this call. After this call, semaphore() will return \c nullptr. + before this call. After this call, semaphore() will return \nullptr. To enable again, assign a new QSemaphoreReleaser: -- cgit v1.2.3