[libcxx-commits] [PATCH] D142422: [libc++] [FreeBSD] only use _umtx_op(2) on 64bit arches

Konstantin Belousov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 23 16:58:26 PST 2023


kib created this revision.
kib added a reviewer: emaste.
Herald added subscribers: krytarowski, arichardson.
Herald added a project: All.
kib requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

  Only 64bit architectures can be supported this way, because libcxx
  defines __cxx_contention_t to be int64_t for FreeBSD, and 32bit
  arches do not have a kind of UMTX_OP_WAIT_INT64_PRIVATE operation.

Fixes: 83387dbc18e7998f87aa4a2d35320bcb2ed5c392ESC


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142422

Files:
  libcxx/src/atomic.cpp


Index: libcxx/src/atomic.cpp
===================================================================
--- libcxx/src/atomic.cpp
+++ libcxx/src/atomic.cpp
@@ -77,20 +77,20 @@
                  const_cast<__cxx_atomic_contention_t*>(__ptr), 0);
 }
 
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) && defined(__LP64__)
 
 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);
+             UMTX_OP_WAIT, __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);
+             UMTX_OP_WAKE, __notify_one ? 1 : INT_MAX, NULL, NULL);
 }
 
 #else // <- Add other operating systems here


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142422.491563.patch
Type: text/x-patch
Size: 1092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230124/cea2ff7e/attachment-0001.bin>


More information about the libcxx-commits mailing list