30#ifndef _GLIBCXX_THIS_THREAD_SLEEP_H
31#define _GLIBCXX_THIS_THREAD_SLEEP_H 1
34#pragma GCC system_header
37#if __cplusplus >= 201103L
41#ifdef _GLIBCXX_USE_NANOSLEEP
46namespace std _GLIBCXX_VISIBILITY(default)
48_GLIBCXX_BEGIN_NAMESPACE_VERSION
61#ifndef _GLIBCXX_NO_SLEEP
64 template<
typename _Rep,
typename _Period>
68 if (__rtime <= __rtime.zero())
71 struct timespec __ts = chrono::__to_timeout_timespec(__rtime);
72#ifdef _GLIBCXX_USE_NANOSLEEP
73 while (::nanosleep(&__ts, &__ts) == -1 && errno == EINTR)
78 void __sleep_for(seconds __s, nanoseconds __ns);
79 __sleep_for(seconds(__ts.tv_sec), nanoseconds(__ts.tv_nsec));
84 template<
typename _Clock,
typename _Duration>
88#if __cplusplus > 201703L
89 static_assert(chrono::is_clock_v<_Clock>);
91 auto __now = _Clock::now();
92 if (_Clock::is_steady)
98 while (__now < __atime)
101 __now = _Clock::now();
109_GLIBCXX_END_NAMESPACE_VERSION
duration< int64_t, nano > nanoseconds
nanoseconds
duration< int64_t > seconds
seconds
ISO C++ entities toplevel namespace is std.
ISO C++ 2011 namespace for interacting with the current thread.
void sleep_until(const chrono::time_point< _Clock, _Duration > &__atime)
this_thread::sleep_until
void sleep_for(const chrono::duration< _Rep, _Period > &__rtime)
this_thread::sleep_for
chrono::duration represents a distance between two points in time
chrono::time_point represents a point in time as measured by a clock