From f794a72f762f659b77270390b47e0949212c54a8 Mon Sep 17 00:00:00 2001 From: safaruqi Date: Tue, 14 Sep 2021 23:00:50 -0400 Subject: [PATCH 1/3] Provided move constructor & move assignment oper. for SpinLock to fix errors related to deleted copy ctors of atomics Signed-Off-By: Salman A. Faruqi --- CMakeLists.txt | 4 ++-- quantum/impl/quantum_spinlock_impl.h | 13 +++++++++++++ quantum/quantum_spinlock.h | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d22f0f4..f6efd7fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ set(CMAKE_BUILD_TYPE Debug) #Set the compiler if the CXX environment variable is not set if (NOT CMAKE_CXX_COMPILER) - set(CMAKE_CXX_COMPILER g++) + set(CMAKE_CXX_COMPILER clang) endif() #Set the compiler if the CXX_STANDARD environment variable is not set if (NOT CMAKE_CXX_STANDARD) @@ -58,7 +58,7 @@ endif() if (QUANTUM_VERBOSE_MAKEFILE) message(STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}") endif() - +set(CXX_EXTENSIONS ON) # Determine if this is a 32 or 64 bit build math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}") diff --git a/quantum/impl/quantum_spinlock_impl.h b/quantum/impl/quantum_spinlock_impl.h index 34fd7172..e226fd8a 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 a52da2d8..6955ff50 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 From 40acd46a94fc7192feaa18f7fc7a02cfa507fe7d Mon Sep 17 00:00:00 2001 From: safaruqi Date: Wed, 15 Sep 2021 07:57:58 -0400 Subject: [PATCH 2/3] revert temp cmakefile changes Signed-Off-By: Salman A. Faruqi --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6efd7fb..5d22f0f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ set(CMAKE_BUILD_TYPE Debug) #Set the compiler if the CXX environment variable is not set if (NOT CMAKE_CXX_COMPILER) - set(CMAKE_CXX_COMPILER clang) + set(CMAKE_CXX_COMPILER g++) endif() #Set the compiler if the CXX_STANDARD environment variable is not set if (NOT CMAKE_CXX_STANDARD) @@ -58,7 +58,7 @@ endif() if (QUANTUM_VERBOSE_MAKEFILE) message(STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}") endif() -set(CXX_EXTENSIONS ON) + # Determine if this is a 32 or 64 bit build math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}") From 36f9da24742083a84028082ab6a49386e28ac0e3 Mon Sep 17 00:00:00 2001 From: safaruqi Date: Wed, 15 Sep 2021 11:22:02 -0400 Subject: [PATCH 3/3] reverting the file changes which reappeared after the amend action to add DCO Signed-Off-By: Salman A. Faruqi --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d22f0f4..a24e52d2 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() +