_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t);
template <class _Atp, class _Fn>
-_LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Fn && __test_fn)
-{
- auto const __libcpp_atomic_wait_backoff = [=](chrono::nanoseconds __elapsed) -> bool {
+struct __libcpp_atomic_wait_backoff_impl {
+ _Atp* __a;
+ _Fn __test_fn;
+ _LIBCPP_INLINE_VISIBILITY bool operator()(chrono::nanoseconds __elapsed) const
+ {
if(__elapsed > chrono::microseconds(64))
{
auto const __monitor = __libcpp_atomic_monitor(__a);
else
; // poll
return false;
- };
- return __libcpp_thread_poll_with_backoff(__test_fn, __libcpp_atomic_wait_backoff);
+ }
+};
+
+template <class _Atp, class _Fn>
+_LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Fn && __test_fn)
+{
+ __libcpp_atomic_wait_backoff_impl<_Atp, typename decay<_Fn>::type> __backoff_fn = {__a, __test_fn};
+ return __libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn);
}
#else // _LIBCPP_HAS_NO_PLATFORM_WAIT
#endif // _LIBCPP_HAS_NO_PLATFORM_WAIT
template <class _Atp, class _Tp>
+struct __cxx_atomic_wait_test_fn_impl {
+ _Atp* __a;
+ _Tp __val;
+ memory_order __order;
+ _LIBCPP_INLINE_VISIBILITY bool operator()() const
+ {
+ return !__cxx_nonatomic_compare_equal(__cxx_atomic_load(__a, __order), __val);
+ }
+};
+
+template <class _Atp, class _Tp>
_LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Tp const __val, memory_order __order)
{
- auto const __test_fn = [=]() -> bool {
- return !__cxx_nonatomic_compare_equal(__cxx_atomic_load(__a, __order), __val);
- };
+ __cxx_atomic_wait_test_fn_impl<_Atp, _Tp> __test_fn = {__a, __val, __order};
return __cxx_atomic_wait(__a, __test_fn);
}
{'is_defined': False, 'name': '__cxa_rethrow_primary_exception', 'type': 'FUNC'}
{'is_defined': False, 'name': '__cxa_throw', 'type': 'FUNC'}
{'is_defined': False, 'name': '__cxa_uncaught_exceptions', 'type': 'FUNC'}
+{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__132__destroy_barrier_algorithm_baseEPNS_24__barrier_algorithm_baseE'}
+{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__123__libcpp_atomic_monitorEPVKv'}
+{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__123__libcpp_atomic_monitorEPVKNS_17__cxx_atomic_implIiNS_22__cxx_atomic_base_implIiEEEE'}
+{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__123__cxx_atomic_notify_allEPVKv'}
+{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__123__cxx_atomic_notify_oneEPVKv'}
+{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__134__construct_barrier_algorithm_baseERl'}
+{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__120__libcpp_atomic_waitEPVKvi'}
+{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__123__cxx_atomic_notify_allEPVKNS_17__cxx_atomic_implIiNS_22__cxx_atomic_base_implIiEEEE'}
+{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__120__libcpp_atomic_waitEPVKNS_17__cxx_atomic_implIiNS_22__cxx_atomic_base_implIiEEEEi'}
+{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__131__arrive_barrier_algorithm_baseEPNS_24__barrier_algorithm_baseEh'}
+{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__123__cxx_atomic_notify_oneEPVKNS_17__cxx_atomic_implIiNS_22__cxx_atomic_base_implIiEEEE'}