oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
ove::thread_id Class Reference

Opaque identity for an oveRTOS thread. std::thread::id analog. More...

#include <thread.hpp>

Public Member Functions

constexpr thread_id (ove_thread_t h) noexcept
 
ove_thread_t native_handle () const noexcept
 

Friends

constexpr bool operator== (const thread_id &, const thread_id &) noexcept=default
 
constexpr auto operator<=> (const thread_id &, const thread_id &) noexcept=default
 

Detailed Description

Opaque identity for an oveRTOS thread. std::thread::id analog.

Default-constructible (represents "no thread"), equality-comparable, and strict-weak-ordered (<=> via the underlying handle pointer). Useful for storing thread identities in associative containers.

Also exposed as Thread<N>::id (alias) to mirror std::thread::id usage — Thread<4096>::id and Thread<2048>::id are the same type, so values from differently-sized wrappers compare cleanly.

ove::Thread<4096> th(worker, OVE_PRIO_NORMAL, "w");
auto tid = th.get_id();
std::map<ove::thread_id, const char *> names;
names[tid] = "worker";
RAII wrapper around an oveRTOS thread (task).
Definition thread.hpp:343

Note: like std::thread::id, the identity is only meaningful while the thread is alive. Once the kernel reaps the thread, the handle value may be reused by a future thread and the two would compare equal — same semantics as std::thread::id.

Member Function Documentation

◆ native_handle()

ove_thread_t ove::thread_id::native_handle ( ) const
inlinenoexcept
Returns
The raw ove_thread_t handle (may be null for default-constructed id).

The documentation for this class was generated from the following file: