[libcxx-commits] [libcxx] [libc++] refactor `cxx_atomic_wait` to make it reusable for atomic_ref (PR #81427)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 1 09:21:03 PST 2024


================
@@ -27,15 +31,45 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Atp, class _Poll>
-struct __libcpp_atomic_wait_poll_impl {
-  _Atp* __a_;
+// The customisation points to enable the following functions:
+// - __atomic_wait
+// - __atomic_wait_unless
+// - __atomic_notify_one
+// - __atomic_notify_all
+// Note that std::atomic<T>::wait was back-ported to C++03
+// The below implementations look ugly to support C++03
+template <class _Tp, class = void>
+struct __atomic_waitable_customisations {
----------------
ldionne wrote:

```suggestion
struct __atomic_waitable_traits {
```

WDYT? `xxxxx_traits` is a common pattern for these kinds of things.

https://github.com/llvm/llvm-project/pull/81427


More information about the libcxx-commits mailing list