From c861b082b3ad6a3925e7e45cb903cf6ae05d582a Mon Sep 17 00:00:00 2001 From: joaquintides Date: Tue, 26 Dec 2023 10:01:16 +0100 Subject: [PATCH] re-strengthened atomic_integral (insert-visit sync) --- .../boost/unordered/detail/foa/concurrent_table.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/boost/unordered/detail/foa/concurrent_table.hpp b/include/boost/unordered/detail/foa/concurrent_table.hpp index cea5be71..e8d06366 100644 --- a/include/boost/unordered/detail/foa/concurrent_table.hpp +++ b/include/boost/unordered/detail/foa/concurrent_table.hpp @@ -203,6 +203,17 @@ private: template struct atomic_integral { +#if defined(BOOST_UNORDERED_LATCH_FREE) + operator Integral()const{return n.load(std::memory_order_acquire);} + void operator=(Integral m){n.store(m,std::memory_order_release);} + void operator|=(Integral m){n.fetch_or(m);} + void operator&=(Integral m){n.fetch_and(m);} + + atomic_integral& operator=(atomic_integral const& rhs) { + n.store(rhs.n.load()); + return *this; + } +#else operator Integral()const{return n.load(std::memory_order_relaxed);} void operator=(Integral m){n.store(m,std::memory_order_relaxed);} void operator|=(Integral m){n.fetch_or(m,std::memory_order_relaxed);} @@ -212,6 +223,7 @@ struct atomic_integral n.store(rhs.n.load(std::memory_order_relaxed),std::memory_order_relaxed); return *this; } +#endif std::atomic n; };