6#ifdef ROO_THREADS_USE_CPPSTD
8#define ROO_THREADS_ATTRIBUTES_SUPPORT_PRIORITY 0
9#define ROO_THREADS_ATTRIBUTES_SUPPORT_NAME 0
10#define ROO_THREADS_ATTRIBUTES_SUPPORT_STACK_SIZE 0
22using thread = std::thread;
24namespace this_thread {
28inline thread::id
get_id() noexcept {
return std::this_thread::get_id(); }
32inline void yield() noexcept { std::this_thread::yield(); }
37inline void sleep_for(
const roo_time::Duration& duration) {
38 static constexpr auto kMaxSafeWaitDelay =
39 std::chrono::microseconds(10LL * 24 * 3600 * 1000000);
40 auto delay = std::chrono::microseconds(duration.inMicros());
41 if (delay > kMaxSafeWaitDelay) {
46 delay = kMaxSafeWaitDelay;
48 std::this_thread::sleep_for(delay);
53inline void sleep_until(
const roo_time::Uptime& when) {
54 sleep_for(when - roo_time::Uptime::Now());
thread::id get_id() noexcept
Returns identifier of the current thread.
void yield() noexcept
Hints the scheduler to run another thread.
void sleep_until(const roo_time::Uptime &when)
Blocks the current thread until the specified time point.
void sleep_for(const roo_time::Duration &duration)
Blocks the current thread for at least the given duration.