From 8d79ceaf8abb111fa87d6a8189d34e5807eb8c20 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 10 Jun 2020 18:20:33 +0300 Subject: [PATCH] Revert using a relaxed load before test_and_set; not necessary, and slower, with a proper yielding strategy as opposed to just pause-spinning --- include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp b/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp index f2c77f0..8cd7179 100644 --- a/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp +++ b/include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp @@ -36,7 +36,7 @@ public: bool try_lock() { - return __atomic_load_n( &v_, __ATOMIC_RELAXED ) == 0 && __atomic_test_and_set( &v_, __ATOMIC_ACQUIRE ) == 0; + return __atomic_test_and_set( &v_, __ATOMIC_ACQUIRE ) == 0; } void lock()