From 5d6d1272718a817c118fe09b784e2de508f95e6b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 4 Apr 2022 18:15:10 +0200 Subject: QFutureInterface: optimize atomic load As all other 20+ users of the state variable, use a relaxed atomic load under the protection of the mutex. There's no need for the loadAcquire() that the implicit conversion operator uses under the hood, because a) we're under mutex protection and b) the state doesn't guard any other data but itself. Found by disabling said implicit conversion operators. Change-Id: I2a76242271cec96175cde503ca883805db6b9212 Reviewed-by: David Faure Reviewed-by: Sona Kurazyan --- src/corelib/thread/qfutureinterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/thread/qfutureinterface.cpp') diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp index cad6111ab9..0fde190bc0 100644 --- a/src/corelib/thread/qfutureinterface.cpp +++ b/src/corelib/thread/qfutureinterface.cpp @@ -177,7 +177,7 @@ void QFutureInterfaceBase::reportSuspended() const // i.e. no more events will be reported. QMutexLocker locker(&d->m_mutex); - const int state = d->state; + const int state = d->state.loadRelaxed(); if (!(state & Suspending) || (state & Suspended)) return; -- cgit v1.2.3