summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qfutureinterface.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-04-04 18:15:10 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-04-05 13:47:15 +0200
commit5d6d1272718a817c118fe09b784e2de508f95e6b (patch)
tree969016865fcbc8371e4294f31a0da020e49240f4 /src/corelib/thread/qfutureinterface.cpp
parenta6657bef406c108ec024b49b847def48162cb795 (diff)
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 <david.faure@kdab.com> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src/corelib/thread/qfutureinterface.cpp')
-rw-r--r--src/corelib/thread/qfutureinterface.cpp2
1 files changed, 1 insertions, 1 deletions
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;