[libcxx-commits] [libcxx] [libc++] Use public os_sync API instead of private __ulock on newer Apple platforms (PR #182947)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 26 13:49:01 PST 2026
================
@@ -90,6 +95,30 @@ static void __platform_wake_by_address(void const* __ptr, bool __notify_one) {
_LIBCPP_FUTEX(__ptr, FUTEX_WAKE_PRIVATE, __notify_one ? 1 : INT_MAX, 0, 0, 0);
}
+#elif defined(__APPLE__) && defined(_LIBCPP_USE_OS_SYNC)
+
+template <std::size_t _Size, class MaybeTimeout>
+static void __platform_wait_on_address(void const* __ptr, void const* __val, MaybeTimeout maybe_timeout_ns) {
+ static_assert(_Size == 8 || _Size == 4, "Can only wait on 8 bytes or 4 bytes value");
+ uint64_t __value = 0;
+ std::memcpy(&__value, __val, _Size);
----------------
huixie90 wrote:
Hmm, even if the destination type has a different size? I can’t find anything that allows or disallow it. So I am too not sure. Wouldn’t the result depend on the endian? (Not that I d expect a different endianness on macOS but just a question in general )
https://github.com/llvm/llvm-project/pull/182947
More information about the libcxx-commits
mailing list