[libcxx-commits] [libcxx] [libc++] fix atomic::wait memory order (PR #146267)

Alastair Harrison via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 1 13:50:24 PDT 2025


================
@@ -163,7 +164,7 @@ static void __libcpp_contention_wait(__cxx_atomic_contention_t volatile* __conte
 static void __libcpp_atomic_notify(void const volatile* __location) {
   auto const __entry = __libcpp_contention_state(__location);
   // The value sequence laundering happens on the next line below.
-  __cxx_atomic_fetch_add(&__entry->__platform_state, __cxx_contention_t(1), memory_order_release);
+  __cxx_atomic_fetch_add(&__entry->__platform_state, __cxx_contention_t(1), memory_order_seq_cst);
----------------
aharrison24 wrote:

I'm not familiar with LLVM coding conventions, but would it be worth adding a note here about the fact that there are no platform guarantees of a memory barrier in the platform wait implementation?

https://github.com/llvm/llvm-project/pull/146267


More information about the libcxx-commits mailing list