[libcxx-commits] [libcxx] [libc++] Fix FreeBSD atomic timed wait system call (PR #180400)
David Chisnall via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 12 02:00:43 PST 2026
================
@@ -130,22 +130,20 @@ static void __platform_wake_by_address(void const* __ptr, bool __notify_one) {
template <std::size_t _Size>
static void __platform_wait_on_address(void const* __ptr, void const* __val, uint64_t __timeout_ns) {
static_assert(_Size == 8, "Can only wait on 8 bytes value");
----------------
davidchisnall wrote:
It looks as if this then falls through to the `#else` branch [here](https://github.com/llvm/llvm-project/blob/847558e7feb4647f82cd3846ec4eef70b0b24f82/libcxx/include/__atomic/contention_t.h#L38C8-L41C1), which defines `__cxx_connection_t` as 8 bytes if not otherwise specified. I believe this means that 32-bit FreeBSD will use 64-bit values for the futex-like things, which is not supported at all by the kernel. Do they always use the table of semaphores for that flow? If not, that's a bug: if you pass a 64-bit value then the kernel will compare only half of it in the wait and will sleep when it should not.
https://github.com/llvm/llvm-project/pull/180400
More information about the libcxx-commits
mailing list