[libcxx-commits] [libcxx] [libc++] Replace mutex+condvar with atomics in __call_once (PR #192433)
Shonie Caplan via libcxx-commits
libcxx-commits at lists.llvm.org
Sun May 31 14:29:54 PDT 2026
================
@@ -25,8 +27,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// keep in sync with: 7741191.
#if _LIBCPP_HAS_THREADS
-static constinit __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER;
-static constinit __libcpp_condvar_t cv = _LIBCPP_CONDVAR_INITIALIZER;
+_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile*) _NOEXCEPT;
----------------
shoniecaplan wrote:
how do you recommend dealing with the `volatile`?
this would not work:
```cpp
std::atomic_ref<once_flag::_State_type> atomic_flag{flag};
```
https://github.com/llvm/llvm-project/pull/192433
More information about the libcxx-commits
mailing list