<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60466>60466</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Consider adding an option to disable the use of __ulock_wait in libc++
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bc-lee
</td>
</tr>
</table>
<pre>
Uses of `__ulock_wait` / `__ulock_wake` in libc++ have been added to support C++20's `std::atomic<T>::wait`.
https://reviews.llvm.org/D68480
https://github.com/llvm/llvm-project/blob/0ce25b12357b24d06cf08cc02719c144d567d5db/libcxx/src/atomic.cpp#L59
https://github.com/llvm/llvm-project/blob/0ce25b12357b24d06cf08cc02719c144d567d5db/libcxx/src/include/apple_availability.h
These APIs are considered private APIs and will result in App Store rejection.
[boostorg/atomic](https://github.com/boostorg/atomic/issues/55)
[rust-lang/rust](https://github.com/rust-lang/rust/issues/93740#issuecomment-1032223557)
libc++ comes natively on Apple platforms, but some projects, e.g., Chromium, WebRTC, etc., prefer to static link their own libc++ builds.
https://source.chromium.org/chromium/chromium/src/+/a2a378674abbcd56a824df4b779f90a2b5a0fb3e:build/config/c++/c++.gni;l=13
```gn
# Use in-tree libc++ (buildtools/third_party/libc++ and
# buildtools/third_party/libc++abi) instead of the system C++ library for C++
# standard library support.
# Don't check in changes that set this to false for more platforms; doing so
# is not supported.
use_custom_libcxx = is_fuchsia || is_android || is_apple || is_linux ||
is_chromeos || (is_win && is_clang)
```
Fortunately, Chromium does not currently use C++20's `std::atomic<T>::wait`, so code using `__ublock_wait` is not currently shipped, but this may change in the future.
So it would be nice to have an option (macro) to disable the use of `__ulock_wait` on Apple platforms.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVslu4zgTfhr6UohBk9p88CFxfgE_MIfBdDfmaHApWZxQpEBScfvtB5TkxOlu9CyXAQSJKhZr-2qhiNGcHeK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