From: Stephen Seo Date: Sun, 14 Jan 2024 01:31:38 +0000 (+0900) Subject: std::atomic doesn't need volatile X-Git-Tag: 1.0~4 X-Git-Url: https://git.seodisparate.com/stephenseo/static/annotated.html?a=commitdiff_plain;h=2cef0d541c269f09a6cff1edf7b90fd62e9d7075;p=UDPConnection std::atomic doesn't need volatile --- diff --git a/src/CXX11_shared_spin_lock.hpp b/src/CXX11_shared_spin_lock.hpp index 53b51d1..aea1927 100644 --- a/src/CXX11_shared_spin_lock.hpp +++ b/src/CXX11_shared_spin_lock.hpp @@ -74,9 +74,9 @@ public: SharedSpinLock(const SharedSpinLock&) = delete; SharedSpinLock& operator=(const SharedSpinLock&) = delete; - // Disallow move. - SharedSpinLock(SharedSpinLock&&) = delete; - SharedSpinLock& operator=(SharedSpinLock&&) = delete; + // Enable move. + SharedSpinLock(SharedSpinLock&&) = default; + SharedSpinLock& operator=(SharedSpinLock&&) = default; LockObj spin_read_lock(); LockObj try_spin_read_lock(); @@ -98,7 +98,7 @@ private: Weak selfWeakPtr; /// Used to lock the read/write member variables. - volatile std::atomic_bool spinLock; + std::atomic_bool spinLock; unsigned int read; bool write;