From 5ee3d405d821d6c524c85c97bb170e96d9f961b8 Mon Sep 17 00:00:00 2001 From: Shamser Ahmed Date: Thu, 1 Feb 2024 04:57:40 +0000 Subject: [PATCH] HPCC-31229 RelaxedAtomic fetch_sub implementation wrong RelaxedAtomic::fetch_sub should call the base class function of the same name. Signed-off-by: Shamser Ahmed --- system/jlib/jatomic.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/jlib/jatomic.hpp b/system/jlib/jatomic.hpp index c32b5db4e6c..2438cc7db1d 100644 --- a/system/jlib/jatomic.hpp +++ b/system/jlib/jatomic.hpp @@ -74,7 +74,7 @@ class RelaxedAtomic : public std::atomic inline T load(std::memory_order order = std::memory_order_relaxed) const noexcept { return BASE::load(order); } inline T exchange(T _value, std::memory_order order = std::memory_order_relaxed) noexcept { return BASE::exchange(_value, order); } inline T fetch_add(T _value, std::memory_order order = std::memory_order_relaxed) noexcept { return BASE::fetch_add(_value, order); } - inline T fetch_sub(T _value, std::memory_order order = std::memory_order_relaxed) noexcept { return BASE::fetch_add(_value, order); } + inline T fetch_sub(T _value, std::memory_order order = std::memory_order_relaxed) noexcept { return BASE::fetch_sub(_value, order); } inline T add_fetch(T _value, std::memory_order order = std::memory_order_relaxed) noexcept { return ::add_fetch(*this, _value, order); } inline T sub_fetch(T _value, std::memory_order order = std::memory_order_relaxed) noexcept { return ::sub_fetch(*this, _value, order); } inline void store_max(T _value) noexcept { while (_value > load()) _value = BASE::exchange(_value, std::memory_order_acq_rel); }