diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d22f0f..a24e52d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,3 +166,4 @@ if (QUANTUM_VERBOSE_MAKEFILE) message(STATUS "REQUIRED BOOST_VERSION = 1.61") message(STATUS "GTEST_ROOT = ${GTEST_ROOT}") endif() + diff --git a/quantum/impl/quantum_spinlock_impl.h b/quantum/impl/quantum_spinlock_impl.h index 34fd717..e226fd8 100644 --- a/quantum/impl/quantum_spinlock_impl.h +++ b/quantum/impl/quantum_spinlock_impl.h @@ -28,6 +28,19 @@ namespace quantum { //============================================================================== // SpinLock //============================================================================== +inline +SpinLock::SpinLock(SpinLock&& o) : _flag(o._flag.load()) { } + +inline +SpinLock& SpinLock::operator=(SpinLock&& o) +{ + if(this != &o) + { + _flag.store(o._flag.load()); + } + return *this; +} + inline void SpinLock::lock() { diff --git a/quantum/quantum_spinlock.h b/quantum/quantum_spinlock.h index a52da2d..6955ff5 100644 --- a/quantum/quantum_spinlock.h +++ b/quantum/quantum_spinlock.h @@ -39,13 +39,13 @@ class SpinLock SpinLock(const SpinLock&) = delete; /// @brief Move constructor. - SpinLock(SpinLock&&) = default; + SpinLock(SpinLock&&); /// @brief Copy assignment operator. SpinLock& operator=(const SpinLock&) = delete; /// @brief Move assignment operator. - SpinLock& operator=(SpinLock&&) = default; + SpinLock& operator=(SpinLock&&); /// @brief Locks this object. /// @note Blocks the current thread until the lock is acquired. Blocking is achieved