diff options
author | David Faure <david.faure@kdab.com> | 2013-10-14 16:57:32 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-02 09:52:42 +0100 |
commit | 3b48a65e99839c9427923c03b4e2a87a8465d165 (patch) | |
tree | ace418fbe952ea34cd0d268d8398600d336e1e24 | |
parent | 7be6438badf00f24b414c2d27d564e636e2b5eb5 (diff) |
QBasicAtomicInt: fix wrong comment about non-atomic API
The public documentation for load() and store() says it's atomic,
and it is:
* using _q_value.store(newValue, std::memory_order_relaxed) in the C++11
implementation
* using a simple assignment otherwise, which is atomic (and relaxed, no
memory barriers) on all the existing C++ ABIs.
Change-Id: I40faa47120163225bd11c3a32514ac97ef8bbbd4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/thread/qbasicatomic.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index ddcc25f7b7..782ae90698 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -137,12 +137,11 @@ public: typename Ops::Type _q_value; - // Non-atomic API + // Everything below is either implemented in ../arch/qatomic_XXX.h or (as fallback) in qgenericatomic.h + T load() const Q_DECL_NOTHROW { return Ops::load(_q_value); } void store(T newValue) Q_DECL_NOTHROW { Ops::store(_q_value, newValue); } - // Atomic API, implemented in qatomic_XXX.h - T loadAcquire() const Q_DECL_NOTHROW { return Ops::loadAcquire(_q_value); } void storeRelease(T newValue) Q_DECL_NOTHROW { Ops::storeRelease(_q_value, newValue); } |