[libcxx-commits] [PATCH] D142134: [libc++] add FreeBSD atomic wait support
Ed Maste via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jan 19 09:23:48 PST 2023
emaste created this revision.
emaste added a reviewer: ldionne.
Herald added subscribers: krytarowski, arichardson.
Herald added a project: All.
emaste requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
>From Konstantin Belousov <kib at freebsd.org>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142134
Files:
libcxx/src/atomic.cpp
Index: libcxx/src/atomic.cpp
===================================================================
--- libcxx/src/atomic.cpp
+++ libcxx/src/atomic.cpp
@@ -26,6 +26,11 @@
# define SYS_futex SYS_futex_time64
#endif
+#elif defined(__FreeBSD__)
+
+#include <sys/types.h>
+#include <sys/umtx.h>
+
#else // <- Add other operating systems here
// Baseline needs no new headers
@@ -72,6 +77,22 @@
const_cast<__cxx_atomic_contention_t*>(__ptr), 0);
}
+#elif defined(__FreeBSD__)
+
+static void __libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr,
+ __cxx_contention_t __val)
+{
+ _umtx_op(const_cast<__cxx_atomic_contention_t*>(__ptr),
+ UMTX_OP_WAIT_UINT_PRIVATE, __val, NULL, NULL);
+}
+
+static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const volatile* __ptr,
+ bool __notify_one)
+{
+ _umtx_op(const_cast<__cxx_atomic_contention_t*>(__ptr),
+ UMTX_OP_WAKE_PRIVATE, __notify_one ? 1 : INT_MAX, NULL, NULL);
+}
+
#else // <- Add other operating systems here
// Baseline is just a timed backoff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142134.490553.patch
Type: text/x-patch
Size: 1191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230119/035b1bd2/attachment-0001.bin>
More information about the libcxx-commits
mailing list