[libcxx-commits] [libcxx] [libc++] Refactor the predicate taking variant of `__cxx_atomic_wait` (PR #80596)

Jan Kokemüller via libcxx-commits libcxx-commits at lists.llvm.org
Sun Feb 18 03:56:19 PST 2024


================
@@ -102,21 +135,19 @@ _LIBCPP_HIDE_FROM_ABI bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp c
   return std::memcmp(std::addressof(__lhs), std::addressof(__rhs), sizeof(_Tp)) == 0;
 }
 
-template <class _Atp, class _Tp>
-struct __cxx_atomic_wait_test_fn_impl {
-  _Atp* __a;
+template <class _Tp>
+struct __cxx_atomic_wait_poll_fn_impl {
----------------
jiixyj wrote:

Yes, a lambda would definitely help. I renamed this struct to `__atomic_compare_unequal_to`. So the logic can be read as "wait unless/until the atomic variable compares unequal to val" (similar to the wording in the spec: <https://eel.is/c++draft/atomics#ref.ops-23.2>).

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


More information about the libcxx-commits mailing list