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>
This commit is contained in:
Marc Mutz 2022-04-04 18:15:10 +02:00
parent a6657bef40
commit 5d6d127271

View File

@ -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;