diff options
Diffstat (limited to 'src/corelib/thread')
| -rw-r--r-- | src/corelib/thread/qatomic.cpp | 13 | ||||
| -rw-r--r-- | src/corelib/thread/qatomic.h | 1 | ||||
| -rw-r--r-- | src/corelib/thread/qbasicatomic.h | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp index d0e61a1cf6c..bcb92b384ae 100644 --- a/src/corelib/thread/qatomic.cpp +++ b/src/corelib/thread/qatomic.cpp @@ -316,6 +316,19 @@ */ /*! + \fn template <typename T> void QAtomicInteger<T>::refRelaxed() + \internal + Atomically increments the value of this QAtomicInteger. + + In contrast to ref(), this uses relaxed semantics, which is + all that is needed for reference counting (together with deref's + acquire-release semantics). + It also doesn't return anything. + + \sa deref(), operator++() +*/ + +/*! \fn template <typename T> T QAtomicInteger<T>::operator++() \since 5.3 diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h index 4fa4fcd2ff5..2e629735128 100644 --- a/src/corelib/thread/qatomic.h +++ b/src/corelib/thread/qatomic.h @@ -46,6 +46,7 @@ public: static constexpr bool isReferenceCountingWaitFree(); bool ref(); + void refRelaxed(); bool deref(); static constexpr bool isTestAndSetNative(); diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index 43337648053..49e686a9de8 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -46,6 +46,7 @@ public: static constexpr bool isReferenceCountingWaitFree() noexcept { return Ops::isReferenceCountingWaitFree(); } bool ref() noexcept { return Ops::ref(_q_value); } + void refRelaxed() noexcept { Ops::fetchAndAddRelaxed(_q_value, 1); } bool deref() noexcept { return Ops::deref(_q_value); } static constexpr bool isTestAndSetNative() noexcept { return Ops::isTestAndSetNative(); } |
