On 04/11/20 10:55 -0800, Thomas Rodgers wrote:
--- a/libstdc++-v3/include/bits/atomic_base.h
+++ b/libstdc++-v3/include/bits/atomic_base.h
@@ -603,13 +603,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
#if __cplusplus > 201703L
+ template<typename _Func>
+ _GLIBCXX_ALWAYS_INLINE void
+ _M_wait(__int_type __old, const _Func& __fn) const noexcept
+ { std::__atomic_wait(&_M_i, __old, __fn); }
+
_GLIBCXX_ALWAYS_INLINE void
wait(__int_type __old,
memory_order __m = memory_order_seq_cst) const noexcept
{
- std::__atomic_wait(&_M_i, __old,
- [__m, this, __old]
- { return this->load(__m) != __old; });
+ _M_wait(__old,
+ [__m, this, __old]
+ { return this->load(__m) != __old; });
}
This looks like it's not meant to be part of this patch.
It also looks wrong for any patch, because it adds _M_wait as a public
member.
Not sure what this piece is for :-)
It is used at include/std/barrier:197 to keep the implementation as close as
possible to the libc++ version upon which it is based.
So the caller in <barrier> can't use __atomic_wait directly because it
can't access the _M_i member of the atomic.
Would it be possible to use atomic_ref instead of atomic, so that the
barrier code has access to the underlying object and can use it
directly with __atomic_wait?