return __v == __GCC_ATOMIC_TEST_AND_SET_TRUEVAL;
}
-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
_GLIBCXX_ALWAYS_INLINE void
wait(bool __old,
memory_order __m = memory_order_seq_cst) const noexcept
{ std::__atomic_notify(&_M_i, true); }
// TODO add const volatile overload
-#endif // HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
#endif // C++20
_GLIBCXX_ALWAYS_INLINE void
__cmpexch_failure_order(__m));
}
-#if __cplusplus > 201703L && defined _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
_GLIBCXX_ALWAYS_INLINE void
wait(__int_type __old,
memory_order __m = memory_order_seq_cst) const noexcept
{ std::__atomic_notify(&_M_i, true); }
// TODO add const volatile overload
-#endif // C++20 && HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
_GLIBCXX_ALWAYS_INLINE __int_type
fetch_add(__int_type __i,
int(__m1), int(__m2));
}
-#if __cplusplus > 201703L && defined _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
_GLIBCXX_ALWAYS_INLINE void
wait(__pointer_type __old,
memory_order __m = memory_order_seq_cst) noexcept
{ std::__atomic_notify(&_M_p, true); }
// TODO add const volatile overload
-#endif // C++20 && HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
_GLIBCXX_ALWAYS_INLINE __pointer_type
fetch_add(ptrdiff_t __d,
int(__success), int(__failure));
}
-#if __cplusplus > 201703L && defined _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
template<typename _Tp>
_GLIBCXX_ALWAYS_INLINE void
wait(const _Tp* __ptr, _Val<_Tp> __old,
{ std::__atomic_notify(__ptr, true); }
// TODO add const volatile overload
-#endif // C++20 && HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
template<typename _Tp>
_GLIBCXX_ALWAYS_INLINE _Tp
__cmpexch_failure_order(__order));
}
-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
_GLIBCXX_ALWAYS_INLINE void
wait(_Fp __old, memory_order __m = memory_order_seq_cst) const noexcept
{ __atomic_impl::wait(&_M_fp, __old, __m); }
{ __atomic_impl::notify_all(&_M_fp); }
// TODO add const volatile overload
-#endif // HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
value_type
fetch_add(value_type __i,
__cmpexch_failure_order(__order));
}
-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
_GLIBCXX_ALWAYS_INLINE void
wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept
{ __atomic_impl::wait(_M_ptr, __old, __m); }
{ __atomic_impl::notify_all(_M_ptr); }
// TODO add const volatile overload
-#endif // HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
private:
_Tp* _M_ptr;
__cmpexch_failure_order(__order));
}
-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
_GLIBCXX_ALWAYS_INLINE void
wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept
{ __atomic_impl::wait(_M_ptr, __old, __m); }
{ __atomic_impl::notify_all(_M_ptr); }
// TODO add const volatile overload
-#endif // HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
value_type
fetch_add(value_type __i,
__cmpexch_failure_order(__order));
}
-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
_GLIBCXX_ALWAYS_INLINE void
wait(_Fp __old, memory_order __m = memory_order_seq_cst) const noexcept
{ __atomic_impl::wait(_M_ptr, __old, __m); }
{ __atomic_impl::notify_all(_M_ptr); }
// TODO add const volatile overload
-#endif // HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
value_type
fetch_add(value_type __i,
__cmpexch_failure_order(__order));
}
-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
_GLIBCXX_ALWAYS_INLINE void
wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept
{ __atomic_impl::wait(_M_ptr, __old, __m); }
{ __atomic_impl::notify_all(_M_ptr); }
// TODO add const volatile overload
-#endif // HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
_GLIBCXX_ALWAYS_INLINE value_type
fetch_add(difference_type __d,
#pragma GCC system_header
#include <bits/atomic_wait.h>
-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT
+
+#ifdef __cpp_lib_atomic_wait
#include <bits/functional_hash.h>
#include <chrono>
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
#endif // _GLIBCXX_ATOMIC_TIMED_WAIT_H
# include <bits/std_mutex.h> // std::mutex, std::__condvar
#endif
-// Other headers use this to check for the facilities defined in this header.
-#define _GLIBCXX_HAVE_ATOMIC_WAIT 1
+#define __cpp_lib_atomic_wait 201907L
namespace std _GLIBCXX_VISIBILITY(default)
{
#pragma GCC system_header
#include <bits/atomic_base.h>
-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT
+#ifdef __cpp_lib_atomic_wait
#include <bits/atomic_timed_wait.h>
#include <ext/numeric_traits.h>
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
#endif // _GLIBCXX_SEMAPHORE_BASE_H
memory_order __m = memory_order_seq_cst) volatile noexcept
{ return _M_base.compare_exchange_strong(__i1, __i2, __m); }
-#if __cplusplus > 201703L && defined _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
void
wait(bool __old, memory_order __m = memory_order_seq_cst) const noexcept
{ _M_base.wait(__old, __m); }
void
notify_all() const noexcept
{ _M_base.notify_all(); }
-#endif // C++20 && HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
};
#if __cplusplus <= 201703L
{ return compare_exchange_strong(__e, __i, __m,
__cmpexch_failure_order(__m)); }
-#if __cplusplus > 201703L && defined _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
void
wait(_Tp __old, memory_order __m = memory_order_seq_cst) const noexcept
{
void
notify_all() const noexcept
{ std::__atomic_notify(&_M_i, true); }
-#endif // C++20 && HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
};
#undef _GLIBCXX20_INIT
__cmpexch_failure_order(__m));
}
-#if __cplusplus > 201703L && _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
void
wait(__pointer_type __old, memory_order __m = memory_order_seq_cst) noexcept
{ _M_b.wait(__old, __m); }
void
notify_all() const noexcept
{ _M_b.notify_all(); }
-#endif // C++20 && HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
__pointer_type
fetch_add(ptrdiff_t __d,
memory_order __m = memory_order_seq_cst) noexcept
}
-#if __cplusplus > 201703L && _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
template<typename _Tp>
inline void
atomic_wait(const atomic<_Tp>* __a,
inline void
atomic_notify_all(atomic<_Tp>* __a) noexcept
{ __a->notify_all(); }
-#endif // C++20 && HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
// Function templates for atomic_integral and atomic_pointer operations only.
// Some operations (and, or, xor) are only available for atomic integrals,
#include <bits/atomic_base.h>
#include <ext/numeric_traits.h>
-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#endif // HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
#endif // __cplusplus > 201703L
#endif // _GLIBCXX_LATCH
#if __cplusplus > 201703L
#include <bits/semaphore_base.h>
-#ifdef _GLIBCXX_HAVE_ATOMIC_WAIT
+#if __cpp_lib_atomic_wait
#include <ext/numeric_traits.h>
namespace std _GLIBCXX_VISIBILITY(default)
using binary_semaphore = std::counting_semaphore<1>;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#endif // HAVE_ATOMIC_WAIT
+#endif // __cpp_lib_atomic_wait
#endif // C++20
#endif // _GLIBCXX_SEMAPHORE
#if _GLIBCXX_HOSTED
#define __cpp_lib_array_constexpr 201811L
#define __cpp_lib_assume_aligned 201811L
+#if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX
+# define __cpp_lib_atomic_wait 201907L
+#endif
#define __cpp_lib_bind_front 201907L
// FIXME: #define __cpp_lib_execution 201902L
#define __cpp_lib_integer_comparison_functions 202002L
#ifdef _GLIBCXX_HAS_GTHREADS
# define __cpp_lib_jthread 201911L
#endif
-#if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX
+#if __cpp_lib_atomic_wait
# define __cpp_lib_latch 201907L
#endif
#define __cpp_lib_list_remove_return_type 201806L
#if __cpp_lib_concepts
# define __cpp_lib_ranges 201911L
#endif
-#if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX
+#if __cpp_lib_atomic_wait
# define __cpp_lib_semaphore 201907L
#endif
#define __cpp_lib_shift 201806L
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+// { dg-require-effective-target gthreads }
+
+#include <atomic>
+
+#ifndef __cpp_lib_atomic_wait
+# error "Feature-test macro for atomic wait missing in <atomic>"
+#elif __cpp_lib_atomic_wait != 201907L
+# error "Feature-test macro for atomic wait has wrong value in <atomic>"
+#endif
+
--- /dev/null
+// Copyright (C) 2020 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+// { dg-require-effective-target gthreads }
+
+#include <version>
+
+#ifndef __cpp_lib_atomic_wait
+# error "Feature-test macro for atomic wait missing in <version>"
+#elif __cpp_lib_atomic_wait != 201907L
+# error "Feature-test macro for atomic wait has wrong value in <version>"
+#endif
+
+