diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2011-09-29 11:52:33 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-02 13:21:32 +0100 |
commit | 409b3b42a233ca58c075a75f35be5ba9b351c7de (patch) | |
tree | e88cdf48672600a4400e1566ea4405ffc38470b0 /src/corelib/thread | |
parent | 3a72240d86dc85f1f2e7d47752953d83c43369c5 (diff) |
Remove cast and assignment operators from QAtomicInt and QAtomicPointer
This is a source incompatible change. There is concern that the
convenience of the implicit cast and assignment operators can lead to
misuse. Several commits have already been done that remove excess use
of the implicit cast, which is a *volatile* read every time it's used.
Users of the QAtomic* API should have to think about when they are
loading the value, and if they do or don't need the acquire memory
barrier on load. The code that people would write using this API is
meant to be multi-threaded, concurrent, and correct. The API should not
allow them to inadvertently, possibly unknowingly, shoot themselves
in the foot.
SC-break-rubber-stamped-by: Lars Knoll
Change-Id: I88fbc26d9db7b5ec80a58ad6271ffa13bbfd191f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r-- | src/corelib/thread/qatomic.h | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h index 34b9011575..eff2182e28 100644 --- a/src/corelib/thread/qatomic.h +++ b/src/corelib/thread/qatomic.h @@ -78,43 +78,12 @@ public: store(other.load()); } - Q_DECL_DEPRECATED - inline QAtomicInt &operator=(int value) - { - this->store(value); - return *this; - } - inline QAtomicInt &operator=(const QAtomicInt &other) { this->store(other.load()); return *this; } - Q_DECL_DEPRECATED - inline bool operator==(int value) const - { - return this->load() == value; - } - - Q_DECL_DEPRECATED - inline bool operator!=(int value) const - { - return this->load() != value; - } - - Q_DECL_DEPRECATED - inline operator int() const - { - return this->load(); - } - - Q_DECL_DEPRECATED - inline bool operator!() const - { - return !this->load(); - } - #ifdef qdoc static bool isReferenceCountingNative(); static bool isReferenceCountingWaitFree(); @@ -168,49 +137,12 @@ public: this->store(other.load()); } - Q_DECL_DEPRECATED - inline QAtomicPointer<T> &operator=(T *value) - { - this->store(value); - return *this; - } - inline QAtomicPointer<T> &operator=(const QAtomicPointer<T> &other) { this->store(other.load()); return *this; } - Q_DECL_DEPRECATED - inline bool operator==(T *value) const - { - return this->load() == value; - } - - Q_DECL_DEPRECATED - inline bool operator!=(T *value) const - { - return this->load() != value; - } - - Q_DECL_DEPRECATED - inline bool operator!() const - { - return !this->load(); - } - - Q_DECL_DEPRECATED - inline operator T *() const - { - return this->load(); - } - - Q_DECL_DEPRECATED - inline T *operator->() const - { - return this->load(); - } - #ifdef qdoc static bool isTestAndSetNative(); static bool isTestAndSetWaitFree(); |