@@ -38,7 +38,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3838// The below implementations look ugly to support C++03
3939template <class _Tp , class = void >
4040struct __atomic_waitable_traits {
41- using __inner_type _LIBCPP_NODEBUG = void ;
41+ using __value_type _LIBCPP_NODEBUG = void ;
4242
4343 template <class _AtomicWaitable >
4444 static void __atomic_load (_AtomicWaitable&&, memory_order) = delete;
@@ -60,7 +60,7 @@ struct __atomic_waitable< _Tp,
6060#if _LIBCPP_STD_VER >= 20
6161# if _LIBCPP_HAS_THREADS
6262
63- <<<<<<< HEAD
63+ // old dylib interface
6464_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one (void const volatile *) _NOEXCEPT;
6565_LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all (void const volatile *) _NOEXCEPT;
6666_LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor (void const volatile *) _NOEXCEPT;
@@ -72,28 +72,30 @@ _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
7272__libcpp_atomic_monitor (__cxx_atomic_contention_t const volatile *) _NOEXCEPT;
7373_LIBCPP_EXPORTED_FROM_ABI void
7474__libcpp_atomic_wait (__cxx_atomic_contention_t const volatile *, __cxx_contention_t ) _NOEXCEPT;
75- =======
76- template <std::size_t _Size>
77- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
78- __libcpp_atomic_wait_native (void const volatile * __address, void const volatile * __old_value) _NOEXCEPT;
7975
80- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
76+ // new dylib interface
77+ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t
8178__libcpp_atomic_monitor_global (void const volatile * __address) _NOEXCEPT;
8279
83- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
80+ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void
8481__libcpp_atomic_wait_global_table (void const volatile * __address, __cxx_contention_t __monitor_value) _NOEXCEPT;
8582
86- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one_global_table (void const volatile *) _NOEXCEPT;
87- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all_global_table (void const volatile *) _NOEXCEPT;
83+ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void
84+ __libcpp_atomic_notify_one_global_table (void const volatile *) _NOEXCEPT;
85+ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void
86+ __libcpp_atomic_notify_all_global_table (void const volatile *) _NOEXCEPT;
87+
88+ template <std::size_t _Size>
89+ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void
8890
91+ __libcpp_atomic_wait_native (void const volatile * __address, void const volatile * __old_value) _NOEXCEPT;
8992template <std::size_t _Size>
90- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
91- __cxx_atomic_notify_one_native (const volatile void *) _NOEXCEPT;
93+ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void
94+ __libcpp_atomic_notify_one_native (const volatile void *) _NOEXCEPT;
9295
9396template <std::size_t _Size>
94- _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void
95- __cxx_atomic_notify_all_native (const volatile void *) _NOEXCEPT;
96- >>>>>>> 59d6fc2ba487 ([libc++] Allows any types of size 4 and 8 to use native platform ulock_wait)
97+ _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_EXPORTED_FROM_ABI void
98+ __libcpp_atomic_notify_all_native (const volatile void *) _NOEXCEPT;
9799
98100template <class _AtomicWaitable , class _Poll >
99101struct __atomic_wait_backoff_impl {
@@ -102,41 +104,17 @@ struct __atomic_wait_backoff_impl {
102104 memory_order __order_;
103105
104106 using __waitable_traits _LIBCPP_NODEBUG = __atomic_waitable_traits<__decay_t <_AtomicWaitable> >;
105- <<<<<<< HEAD
106-
107- _LIBCPP_HIDE_FROM_ABI bool
108- __update_monitor_val_and_poll (__cxx_atomic_contention_t const volatile *, __cxx_contention_t & __monitor_val) const {
109- // In case the contention type happens to be __cxx_atomic_contention_t, i.e. __cxx_atomic_impl<int64_t>,
110- // the platform wait is directly monitoring the atomic value itself.
111- // `__poll_` takes the current value of the atomic as an in-out argument
112- // to potentially modify it. After it returns, `__monitor` has a value
113- // which can be safely waited on by `std::__libcpp_atomic_wait` without any
114- // ABA style issues.
115- __monitor_val = __waitable_traits::__atomic_load (__a_, __order_);
116- return __poll_ (__monitor_val);
117- }
118-
119- _LIBCPP_HIDE_FROM_ABI bool
120- __update_monitor_val_and_poll (void const volatile * __contention_address, __cxx_contention_t & __monitor_val) const {
121- // In case the contention type is anything else, platform wait is monitoring a __cxx_atomic_contention_t
122- // from the global pool, the monitor comes from __libcpp_atomic_monitor
123- __monitor_val = std::__libcpp_atomic_monitor (__contention_address);
124- auto __current_val = __waitable_traits::__atomic_load (__a_, __order_);
125- return __poll_ (__current_val);
126- }
127- =======
128- using __inner_type _LIBCPP_NODEBUG = typename __waitable_traits::__inner_type;
129- >>>>>>> 59d6fc2ba487 ([libc++] Allows any types of size 4 and 8 to use native platform ulock_wait)
107+ using __value_type _LIBCPP_NODEBUG = typename __waitable_traits::__value_type;
130108
131109 _LIBCPP_HIDE_FROM_ABI bool operator ()(chrono::nanoseconds __elapsed) const {
132110 if (__elapsed > chrono::microseconds (4 )) {
133111 auto __contention_address = __waitable_traits::__atomic_contention_address (__a_);
134112
135- if constexpr (__is_atomic_wait_native_type<__inner_type >::value) {
113+ if constexpr (__is_atomic_wait_native_type<__value_type >::value) {
136114 auto __atomic_value = __waitable_traits::__atomic_load (__a_, __order_);
137115 if (__poll_ (__atomic_value))
138116 return true ;
139- std::__libcpp_atomic_wait_native<sizeof (__inner_type )>(__contention_address, &__atomic_value);
117+ std::__libcpp_atomic_wait_native<sizeof (__value_type )>(__contention_address, &__atomic_value);
140118 } else {
141119 __cxx_contention_t __monitor_val = std::__libcpp_atomic_monitor_global (__contention_address);
142120 auto __atomic_value = __waitable_traits::__atomic_load (__a_, __order_);
@@ -174,22 +152,26 @@ _LIBCPP_HIDE_FROM_ABI void __atomic_wait_unless(const _AtomicWaitable& __a, memo
174152template <class _AtomicWaitable >
175153_LIBCPP_HIDE_FROM_ABI void __atomic_notify_one (const _AtomicWaitable& __a) {
176154 static_assert (__atomic_waitable<_AtomicWaitable>::value, " " );
177- using __inner_type _LIBCPP_NODEBUG = typename __atomic_waitable_traits<__decay_t <_AtomicWaitable> >::__inner_type;
178- if constexpr (__is_atomic_wait_native_type<__inner_type>::value) {
179- std::__cxx_atomic_notify_one_native<sizeof (__inner_type)>(__atomic_waitable_traits<__decay_t <_AtomicWaitable> >::__atomic_contention_address (__a));
155+ using __value_type _LIBCPP_NODEBUG = typename __atomic_waitable_traits<__decay_t <_AtomicWaitable> >::__value_type;
156+ if constexpr (__is_atomic_wait_native_type<__value_type>::value) {
157+ std::__libcpp_atomic_notify_one_native<sizeof (__value_type)>(
158+ __atomic_waitable_traits<__decay_t <_AtomicWaitable> >::__atomic_contention_address (__a));
180159 } else {
181- std::__cxx_atomic_notify_one_global_table (__atomic_waitable_traits<__decay_t <_AtomicWaitable> >::__atomic_contention_address (__a));
160+ std::__libcpp_atomic_notify_one_global_table (
161+ __atomic_waitable_traits<__decay_t <_AtomicWaitable> >::__atomic_contention_address (__a));
182162 }
183163}
184164
185165template <class _AtomicWaitable >
186166_LIBCPP_HIDE_FROM_ABI void __atomic_notify_all (const _AtomicWaitable& __a) {
187167 static_assert (__atomic_waitable<_AtomicWaitable>::value, " " );
188- using __inner_type _LIBCPP_NODEBUG = typename __atomic_waitable_traits<__decay_t <_AtomicWaitable> >::__inner_type;
189- if constexpr (__is_atomic_wait_native_type<__inner_type>::value) {
190- std::__cxx_atomic_notify_all_native<sizeof (__inner_type)>(__atomic_waitable_traits<__decay_t <_AtomicWaitable> >::__atomic_contention_address (__a));
168+ using __value_type _LIBCPP_NODEBUG = typename __atomic_waitable_traits<__decay_t <_AtomicWaitable> >::__value_type;
169+ if constexpr (__is_atomic_wait_native_type<__value_type>::value) {
170+ std::__libcpp_atomic_notify_all_native<sizeof (__value_type)>(
171+ __atomic_waitable_traits<__decay_t <_AtomicWaitable> >::__atomic_contention_address (__a));
191172 } else {
192- std::__cxx_atomic_notify_all_global_table (__atomic_waitable_traits<__decay_t <_AtomicWaitable> >::__atomic_contention_address (__a));
173+ std::__libcpp_atomic_notify_all_global_table (
174+ __atomic_waitable_traits<__decay_t <_AtomicWaitable> >::__atomic_contention_address (__a));
193175 }
194176}
195177
0 commit comments