diff options
author | peterbell10 <peterbell10@live.co.uk> | 2020-05-10 18:16:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-10 18:16:38 +0200 |
commit | 154df6b09d0c39ef9a9b1ee049251b645c13f559 (patch) | |
tree | dd5976d81910d369e09b95c35fd89cd8cccb378c /src/OSSupport/AtomicUniquePtr.h | |
parent | Remove pkFishingFloat documentation (#4732) (diff) | |
download | cuberite-154df6b09d0c39ef9a9b1ee049251b645c13f559.tar cuberite-154df6b09d0c39ef9a9b1ee049251b645c13f559.tar.gz cuberite-154df6b09d0c39ef9a9b1ee049251b645c13f559.tar.bz2 cuberite-154df6b09d0c39ef9a9b1ee049251b645c13f559.tar.lz cuberite-154df6b09d0c39ef9a9b1ee049251b645c13f559.tar.xz cuberite-154df6b09d0c39ef9a9b1ee049251b645c13f559.tar.zst cuberite-154df6b09d0c39ef9a9b1ee049251b645c13f559.zip |
Diffstat (limited to 'src/OSSupport/AtomicUniquePtr.h')
-rw-r--r-- | src/OSSupport/AtomicUniquePtr.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/OSSupport/AtomicUniquePtr.h b/src/OSSupport/AtomicUniquePtr.h index 5b18763d3..92debbac6 100644 --- a/src/OSSupport/AtomicUniquePtr.h +++ b/src/OSSupport/AtomicUniquePtr.h @@ -11,34 +11,34 @@ public: static_assert(!std::is_array<T>::value, "cAtomicUniquePtr does not support arrays"); DISALLOW_COPY_AND_ASSIGN(cAtomicUniquePtr); - cAtomicUniquePtr() NOEXCEPT: + cAtomicUniquePtr() noexcept: m_Ptr(nullptr) { } - cAtomicUniquePtr(std::unique_ptr<T> a_Ptr) NOEXCEPT: + cAtomicUniquePtr(std::unique_ptr<T> a_Ptr) noexcept: m_Ptr(a_Ptr.release()) { } - cAtomicUniquePtr & operator = (std::unique_ptr<T> a_Ptr) NOEXCEPT + cAtomicUniquePtr & operator = (std::unique_ptr<T> a_Ptr) noexcept { store(std::move(a_Ptr)); return *this; } - ~cAtomicUniquePtr() NOEXCEPT + ~cAtomicUniquePtr() noexcept { delete load(); } - operator T * () const NOEXCEPT + operator T * () const noexcept { return load(); } - bool compare_exchange_weak(T *& a_Expected, std::unique_ptr<T> && a_Desired, std::memory_order a_Order = std::memory_order_seq_cst) NOEXCEPT + bool compare_exchange_weak(T *& a_Expected, std::unique_ptr<T> && a_Desired, std::memory_order a_Order = std::memory_order_seq_cst) noexcept { bool DidExchange = m_Ptr.compare_exchange_weak(a_Expected, a_Desired.get(), a_Order); if (DidExchange) @@ -49,7 +49,7 @@ public: return DidExchange; } - bool compare_exchange_strong(T *& a_Expected, std::unique_ptr<T> && a_Desired, std::memory_order a_Order = std::memory_order_seq_cst) NOEXCEPT + bool compare_exchange_strong(T *& a_Expected, std::unique_ptr<T> && a_Desired, std::memory_order a_Order = std::memory_order_seq_cst) noexcept { bool DidExchange = m_Ptr.compare_exchange_strong(a_Expected, a_Desired.get(), a_Order); if (DidExchange) @@ -60,17 +60,17 @@ public: return DidExchange; } - std::unique_ptr<T> exchange(std::unique_ptr<T> a_Ptr, std::memory_order a_Order = std::memory_order_seq_cst) NOEXCEPT + std::unique_ptr<T> exchange(std::unique_ptr<T> a_Ptr, std::memory_order a_Order = std::memory_order_seq_cst) noexcept { return std::unique_ptr<T>{ m_Ptr.exchange(a_Ptr.release(), a_Order) }; } - T * load(std::memory_order a_Order = std::memory_order_seq_cst) const NOEXCEPT + T * load(std::memory_order a_Order = std::memory_order_seq_cst) const noexcept { return m_Ptr.load(a_Order); } - void store(std::unique_ptr<T> a_Ptr, std::memory_order a_Order = std::memory_order_seq_cst) NOEXCEPT + void store(std::unique_ptr<T> a_Ptr, std::memory_order a_Order = std::memory_order_seq_cst) noexcept { // Store new value and delete old value delete m_Ptr.exchange(a_Ptr.release(), a_Order); |