diff options
Diffstat (limited to 'src/corelib/tools/qrefcount.h')
-rw-r--r-- | src/corelib/tools/qrefcount.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/corelib/tools/qrefcount.h b/src/corelib/tools/qrefcount.h index 9586c3a79a..2e5388ad9a 100644 --- a/src/corelib/tools/qrefcount.h +++ b/src/corelib/tools/qrefcount.h @@ -51,8 +51,8 @@ namespace QtPrivate class RefCount { public: - inline bool ref() Q_DECL_NOTHROW { - int count = atomic.load(); + inline bool ref() noexcept { + int count = atomic.loadRelaxed(); #if !defined(QT_NO_UNSHARABLE_CONTAINERS) if (count == 0) // !isSharable return false; @@ -62,8 +62,8 @@ public: return true; } - inline bool deref() Q_DECL_NOTHROW { - int count = atomic.load(); + inline bool deref() noexcept { + int count = atomic.loadRelaxed(); #if !defined(QT_NO_UNSHARABLE_CONTAINERS) if (count == 0) // !isSharable return false; @@ -74,7 +74,7 @@ public: } #if !defined(QT_NO_UNSHARABLE_CONTAINERS) - bool setSharable(bool sharable) Q_DECL_NOTHROW + bool setSharable(bool sharable) noexcept { Q_ASSERT(!isShared()); if (sharable) @@ -83,27 +83,27 @@ public: return atomic.testAndSetRelaxed(1, 0); } - bool isSharable() const Q_DECL_NOTHROW + bool isSharable() const noexcept { // Sharable === Shared ownership. - return atomic.load() != 0; + return atomic.loadRelaxed() != 0; } #endif - bool isStatic() const Q_DECL_NOTHROW + bool isStatic() const noexcept { // Persistent object, never deleted - return atomic.load() == -1; + return atomic.loadRelaxed() == -1; } - bool isShared() const Q_DECL_NOTHROW + bool isShared() const noexcept { - int count = atomic.load(); + int count = atomic.loadRelaxed(); return (count != 1) && (count != 0); } - void initializeOwned() Q_DECL_NOTHROW { atomic.store(1); } - void initializeUnsharable() Q_DECL_NOTHROW { atomic.store(0); } + void initializeOwned() noexcept { atomic.storeRelaxed(1); } + void initializeUnsharable() noexcept { atomic.storeRelaxed(0); } QBasicAtomicInt atomic; }; |