[libcxx-commits] [libcxx] [libc++] FreeBSD use fallback for atomic timed wait (PR #180400)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Feb 8 02:02:55 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Hui (huixie90)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/180400.diff
1 Files Affected:
- (modified) libcxx/src/atomic.cpp (+4-11)
``````````diff
diff --git a/libcxx/src/atomic.cpp b/libcxx/src/atomic.cpp
index 637c971ed8896..b198cf845f504 100644
--- a/libcxx/src/atomic.cpp
+++ b/libcxx/src/atomic.cpp
@@ -135,17 +135,10 @@ static void __platform_wait_on_address(void const* __ptr, void const* __val, uin
if (__timeout_ns == 0) {
_umtx_op(const_cast<void*>(__ptr), UMTX_OP_WAIT, *reinterpret_cast<__cxx_contention_t*>(&buffer), nullptr, nullptr);
} else {
- _umtx_time ut;
- ut._timeout.tv_sec = __timeout_ns / 1'000'000'000;
- ut._timeout.tv_nsec = __timeout_ns % 1'000'000'000;
- ut._flags = 0; // Relative time (not absolute)
- ut._clockid = CLOCK_MONOTONIC; // Use monotonic clock
-
- _umtx_op(const_cast<void*>(__ptr),
- UMTX_OP_WAIT,
- *reinterpret_cast<__cxx_contention_t*>(&buffer),
- reinterpret_cast<void*>(sizeof(ut)), // Pass size as uaddr
- &ut); // Pass _umtx_time structure as uaddr2
+ __libcpp_thread_poll_with_backoff(
+ [=]() -> bool { return std::memcmp(const_cast<const void*>(__ptr), __val, _Size) != 0; },
+ __libcpp_timed_backoff_policy(),
+ std::chrono::nanoseconds(__timeout_ns));
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/180400
More information about the libcxx-commits
mailing list