From f59415c436223afc5a1bc318ddea97363f51396f Mon Sep 17 00:00:00 2001 From: Michael Hufer Date: Thu, 14 Dec 2023 10:28:35 +0100 Subject: [PATCH] Fixed possible data race in ACE_Future::set()/get() .. some CPUs can try to optimze memory(cache) store instructions by changing the order of "mov" instructions. .. additionally the gcc compiler sometimes also does such an optiomization and first store the pointer than the value into the memory (int*ptr = new arg*arg; triggered this in our tests when compiled with gcc-9.3 -O2). --- ACE/ace/Future.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACE/ace/Future.h b/ACE/ace/Future.h index 4858bcad6f8..776e9d06e99 100644 --- a/ACE/ace/Future.h +++ b/ACE/ace/Future.h @@ -197,7 +197,7 @@ private: int ready () const; /// Pointer to the result. - T *value_; + std::atomic value_; /// Reference count. int ref_count_; -- 2.34.1