Fix QBasicAtomicPointer::{load,store} to actually be relaxed

We were using direct loading and operator=, which for everything except
std::atomic was very relaxed. But std::atomic<T *> defines the direct
access to actually be the least relaxed possible, under the idea that if
you didn't know any better to use a member function, you probably need
the most protection.

So use Ops::load and Ops::store.

Change-Id: Id5480807d25e49e78b79ffff144a06a2e6398576
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
bb10
Thiago Macieira 2016-04-29 20:52:05 -07:00
parent ad66dbe305
commit 29076cf6cb
1 changed files with 2 additions and 2 deletions

View File

@ -249,8 +249,8 @@ public:
AtomicType _q_value;
Type load() const Q_DECL_NOTHROW { return _q_value; }
void store(Type newValue) Q_DECL_NOTHROW { _q_value = newValue; }
Type load() const Q_DECL_NOTHROW { return Ops::load(_q_value); }
void store(Type newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); }
operator Type() const Q_DECL_NOTHROW { return loadAcquire(); }
Type operator=(Type newValue) Q_DECL_NOTHROW { storeRelease(newValue); return newValue; }