diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-04-04 18:22:46 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-04-05 14:27:16 +0000 |
commit | bfd2d301693bbf278157db23dd322d30d66edd3b (patch) | |
tree | f3a8725a4cdaafc23643819fbdf5bc159887f9bd /src/network/kernel/qhostinfo.h | |
parent | 8116fdde1c13fe00fb03414b56da2d66e215f279 (diff) |
WhenAllContext: optimize atomic operations
The old code performed one load-acquire (in the assertion) and one
ordered(!) fetch_sub() (in the pre-decrement operator) where one
relaxed fetch_sub() would suffice (it's just a counter).
Fix by caching the result of the relaxed fetch_sub() and performing
the following checks on the cached result.
As drive-bys, rename the atomic member variable (to catch any outside
uses) and make the ctor explicit.
Found by locally disabling the QAtomic<T> -> T implicit conversion
operators.
Change-Id: Ifdc11c2c4807b71f4cab2ba9f5405ace7d8d71a9
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src/network/kernel/qhostinfo.h')
0 files changed, 0 insertions, 0 deletions