5#if (defined ROO_THREADS_USE_FREERTOS)
15using thread = ::roo_threads::freertos::thread;
16namespace this_thread {
19inline thread::id
get_id() noexcept {
20 return roo_threads::freertos::this_thread::get_id();
24inline void yield() noexcept { roo_threads::freertos::this_thread::yield(); }
28inline void sleep_for(
const roo_time::Duration& duration) {
29 roo_threads::freertos::this_thread::sleep_for(duration);
34inline void sleep_until(
const roo_time::Uptime& when) {
35 roo_threads::freertos::this_thread::sleep_until(when);
42#elif (defined ROO_THREADS_USE_CPPSTD)
49using thread = roo_threads::cppstd::thread;
51namespace this_thread {
54inline thread::id
get_id() noexcept {
55 return roo_threads::cppstd::this_thread::get_id();
59inline void yield() noexcept { roo_threads::cppstd::this_thread::yield(); }
63inline void sleep_for(
const roo_time::Duration& duration) {
64 roo_threads::cppstd::this_thread::sleep_for(duration);
69inline void sleep_until(
const roo_time::Uptime& when) {
70 roo_threads::cppstd::this_thread::sleep_until(when);
77#elif (defined ROO_THREADS_USE_ROO_TESTING)
79#include "roo_threads/impl/roo_testing/thread.h"
84using thread = ::roo_threads::roo_testing::thread;
86namespace this_thread {
89inline thread::id
get_id() noexcept {
90 return roo_threads::roo_testing::this_thread::get_id();
94inline void yield() noexcept { roo_threads::roo_testing::this_thread::yield(); }
98inline void sleep_for(
const roo_time::Duration& duration) {
99 roo_threads::roo_testing::this_thread::sleep_for(duration);
104inline void sleep_until(
const roo_time::Uptime& when) {
105 roo_threads::roo_testing::this_thread::sleep_until(when);
112#elif (defined ROO_THREADS_SINGLETHREADED)
119using thread = roo_threads::singlethreaded::thread;
121namespace this_thread {
124inline thread::id
get_id() noexcept {
125 return roo_threads::singlethreaded::this_thread::get_id();
129inline void yield() noexcept {
130 roo_threads::singlethreaded::this_thread::yield();
135inline void sleep_for(
const roo_time::Duration& duration) {
136 roo_threads::singlethreaded::this_thread::sleep_for(duration);
141inline void sleep_until(
const roo_time::Uptime& when) {
142 roo_threads::singlethreaded::this_thread::sleep_until(when);
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.