[libcxx-commits] [libcxx] [libc++] remove yield from atomic::wait (PR #120012)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 16 06:24:51 PST 2024


================
@@ -108,15 +108,13 @@ struct __atomic_wait_backoff_impl {
 
   _LIBCPP_AVAILABILITY_SYNC
   _LIBCPP_HIDE_FROM_ABI bool operator()(chrono::nanoseconds __elapsed) const {
-    if (__elapsed > chrono::microseconds(64)) {
+    if (__elapsed > chrono::microseconds(4)) {
       auto __contention_address = __waitable_traits::__atomic_contention_address(__a_);
       __cxx_contention_t __monitor_val;
       if (__update_monitor_val_and_poll(__contention_address, __monitor_val))
         return true;
       std::__libcpp_atomic_wait(__contention_address, __monitor_val);
-    } else if (__elapsed > chrono::microseconds(4))
-      __libcpp_thread_yield();
-    else {
+    } else {
----------------
ldionne wrote:

I think we can remove the `#include <__thread/support.h>` include above.

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


More information about the libcxx-commits mailing list