libstdc++: Only define std::latch if atomic waiting is available

libstdc++-v3/ChangeLog:

	* include/std/latch: Depend on _GLIBCXX_HAS_GTHREADS and
	_GLIBCXX_HAVE_LINUX_FUTEX.
	* include/std/version (__cpp_lib_latch): Define conditionally.
This commit is contained in:
Jonathan Wakely 2020-11-26 21:54:46 +00:00
parent 1a00786414
commit 7198827486
2 changed files with 9 additions and 4 deletions

View File

@ -27,20 +27,22 @@
*/
#ifndef _GLIBCXX_LATCH
#define _GLIBCXX_LATCH
#define _GLIBCXX_LATCH 1
#pragma GCC system_header
#if __cplusplus > 201703L
#define __cpp_lib_latch 201907L
#include <bits/atomic_base.h>
#include <ext/numeric_traits.h>
#if defined _GLIBCXX_HAS_GTHREADS || _GLIBCXX_HAVE_LINUX_FUTEX
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#define __cpp_lib_latch 201907L
class latch
{
public:
@ -87,5 +89,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // GTHREADS || LINUX_FUTEX
#endif // __cplusplus > 201703L
#endif // _GLIBCXX_LATCH

View File

@ -216,7 +216,9 @@
#ifdef _GLIBCXX_HAS_GTHREADS
# define __cpp_lib_jthread 201911L
#endif
#define __cpp_lib_latch 201907L
#if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX
# define __cpp_lib_latch 201907L
#endif
#define __cpp_lib_list_remove_return_type 201806L
#if __cpp_lib_concepts
# define __cpp_lib_make_obj_using_allocator 201811L
@ -226,7 +228,7 @@
#if __cpp_lib_concepts
# define __cpp_lib_ranges 201911L
#endif
#if defined _GLIBCXX_HAS_GTHREADS || _GLIBCXX_HAVE_LINUX_FUTEX
#if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX
# define __cpp_lib_semaphore 201907L
#endif
#define __cpp_lib_shift 201806L