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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 16 10:29:55 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) {
----------------
ldionne wrote:

This would require a switch based on availability.

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


More information about the libcxx-commits mailing list