|
oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
|
Lightweight read-only handle to a thread's cooperative cancellation flag. More...
#include <thread.hpp>
Public Member Functions | |
| constexpr | stop_token (ove_thread_t h) noexcept |
| bool | stop_requested () const noexcept |
| bool | stop_possible () const noexcept |
| operator bool () const noexcept | |
Convertible to bool reflecting stop_requested. | |
| ove_thread_t | handle () const noexcept |
Lightweight read-only handle to a thread's cooperative cancellation flag.
Mirrors std::stop_token (C++20) but does NOT pull in the heavyweight <stop_token> header (which drags in <stop_source>, <stop_callback>, and condvar machinery — overkill for embedded). Trivially copyable; pass by value freely.
Workers built with the cooperative Thread constructor receive a stop_token as their entry argument:
The token can be passed to helper functions that need to bail out cooperatively. Setting the underlying flag is done via Thread::request_stop() or the parent's ~Thread(); the token is read-only by design.
|
inlinenoexcept |
true if a stop has been requested for the referenced thread.
|
inlinenoexcept |
true if the token references a real thread (non-default-constructed).
|
inlineexplicitnoexcept |
Convertible to bool reflecting stop_requested.
Enables if (tok) { … } shorthand. explicit prevents accidental implicit conversions in boolean-context-free positions.
|
inlinenoexcept |
ove_thread_t handle for advanced use.