diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-10-25 16:35:58 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-11-28 04:37:10 +0000 |
commit | dba606767056986a8c0cc973ec5932f603f14759 (patch) | |
tree | aca909fa2fa06b984f54b8577c629b6068e892f0 /src/corelib/plugin/qelfparser_p.cpp | |
parent | 4447db44652420d80886de8de4b02f3bcd9fe86c (diff) |
Optimize QSharedPointer::getAndRef with the three-operand testAndSet
Originally QAtomicPointer didn't have the three-operand version,
resulting in code like:
if (!atomic.testAndSetXxx(expected, newvalue))
expected = atomic.load();
The three-operand version gives us the current value of the atomic in
case the test failed and it's free in all architectures, unlike the
extra load.
I have to use testAndSetOrdered here because I need the failing load to
use the Acquire memory order, even though that has an extra Acquire for
the successful case we don't need. QAtomicPointer does not have
testAndSetReleaseAcquire.
Change-Id: I1bd327aeaf73421a8ec5fffd1560fe30d3bfd9b8
Reviewed-by: Romain Pokrzywka <romain.pokrzywka@gmail.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Diffstat (limited to 'src/corelib/plugin/qelfparser_p.cpp')
0 files changed, 0 insertions, 0 deletions