From ba05fb4d0cdf397d6dd77a40dfa986bc4b465b22 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Wed, 17 Dec 2014 13:40:27 +0100 Subject: [PATCH] Use acquire semantics after all... ;-) According to this page, the relaxed semantics are a useless optimization and might in fact degrade performance on some systems: http://www.boost.org/doc/libs/master/doc/html/atomic/usage_examples.html#boost_atomic.usage_examples.example_spinlock --- libheaptrack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libheaptrack.cpp b/libheaptrack.cpp index b581bc9..bf33593 100644 --- a/libheaptrack.cpp +++ b/libheaptrack.cpp @@ -416,7 +416,7 @@ private: HeapTrack(AdditionalLockCheck lockCheck) { debugLog("%s", "acquiring lock"); - while (s_locked.exchange(true, std::memory_order_relaxed) && lockCheck()) { + while (s_locked.exchange(true, std::memory_order_acquire) && lockCheck()) { std::this_thread::yield(); } debugLog("%s", "lock acquired"); -- 2.7.4