[libcxx-commits] [libcxx] [libc++] atomic timed wait (PR #172214)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jan 17 05:44:05 PST 2026


================
@@ -107,9 +106,10 @@ public:
   _LIBCPP_HIDE_FROM_ABI bool try_acquire_for(chrono::duration<_Rep, _Period> const& __rel_time) {
     if (__rel_time == chrono::duration<_Rep, _Period>::zero())
       return try_acquire();
-    auto const __poll_fn = [this]() { return try_acquire(); };
-    return std::__libcpp_thread_poll_with_backoff(__poll_fn, __libcpp_timed_backoff_policy(), __rel_time) ==
-           __poll_with_backoff_results::__poll_success;
+
+    return std::__atomic_wait_unless_with_timeout(__a_, memory_order_relaxed, [this](ptrdiff_t& __old) {
----------------
huixie90 wrote:

as discussed `__atomic_wait_unless_with_timeout` itself already handles the availability

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


More information about the libcxx-commits mailing list