[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:33:23 PST 2024


================
@@ -43,15 +56,40 @@ __libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*);
 _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
 __libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t);
 
-template <class _Atp, class _BackoffTest>
+template <class _Atp, class _Poll>
 struct __libcpp_atomic_wait_backoff_impl {
   _Atp* __a_;
-  _BackoffTest __backoff_test_;
+  _Poll __poll_;
+  memory_order __order_;
+
+  _LIBCPP_AVAILABILITY_SYNC
+  _LIBCPP_HIDE_FROM_ABI bool
+  __poll_or_get_monitor(__cxx_atomic_contention_t const volatile*, __cxx_contention_t& __monitor) const {
----------------
jiixyj wrote:

Yes, the two `__poll_or_get_monitor` functions here are basically the same thing as the two `__update_monitor_val_and_poll` functions from #81427 ([here](<https://github.com/llvm/llvm-project/pull/81427/files#diff-7202d31e2a9550950ef2b4630acd4d6d44d9f86e721082c25c0e242a2faccf9fR99-R116>)).

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


More information about the libcxx-commits mailing list