30 #ifndef _GLIBCXX_THIS_THREAD_SLEEP_H 31 #define _GLIBCXX_THIS_THREAD_SLEEP_H 1 33 #pragma GCC system_header 35 #if __cplusplus >= 201103L 40 #ifdef _GLIBCXX_USE_NANOSLEEP 45 namespace std _GLIBCXX_VISIBILITY(default)
47 _GLIBCXX_BEGIN_NAMESPACE_VERSION
60 #ifndef _GLIBCXX_NO_SLEEP 62 #ifndef _GLIBCXX_USE_NANOSLEEP 68 template<
typename _Rep,
typename _Period>
72 if (__rtime <= __rtime.zero())
76 #ifdef _GLIBCXX_USE_NANOSLEEP 77 struct ::timespec __ts =
79 static_cast<std::time_t
>(__s.count()),
80 static_cast<long>(__ns.count())
82 while (::nanosleep(&__ts, &__ts) == -1 && errno == EINTR)
85 __sleep_for(__s, __ns);
90 template<
typename _Clock,
typename _Duration>
94 #if __cplusplus > 201703L 95 static_assert(chrono::is_clock_v<_Clock>);
97 auto __now = _Clock::now();
98 if (_Clock::is_steady)
104 while (__now < __atime)
107 __now = _Clock::now();
115 _GLIBCXX_END_NAMESPACE_VERSION
119 #endif // _GLIBCXX_THIS_THREAD_SLEEP_H duration< int64_t > seconds
seconds
duration< int64_t, nano > nanoseconds
nanoseconds
constexpr __enable_if_is_duration< _ToDur > duration_cast(const duration< _Rep, _Period > &__d)
duration_cast
chrono::duration represents a distance between two points in time
void sleep_until(const chrono::time_point< _Clock, _Duration > &__atime)
this_thread::sleep_until
chrono::time_point represents a point in time as measured by a clock
ISO C++ entities toplevel namespace is std.
void sleep_for(const chrono::duration< _Rep, _Period > &__rtime)
this_thread::sleep_for