ThreadAbstraction

Trait ThreadAbstraction 

pub trait ThreadAbstraction {
    // Required method
    fn current_thread_id() -> NonZero<u64>;
}
Available on crate feature osal-embassy only.
Expand description

ThreadAbstraction is used to query thread-related information in a platform-agnostic manner.

Required Methods§

fn current_thread_id() -> NonZero<u64>

Returns a unique identifier for the current thread.

The returned id is guaranteed to be unique within the lifetime of the process. Thread ids are not reused, even after a thread terminates.

This is useful for telemetry and tracing, where thread ids can be included in spans and logs to help correlate events to specific threads of execution.

§Example
use veecle_osal_api::thread::ThreadAbstraction;
use veecle_osal_std::thread::Thread;

let thread_id = Thread::current_thread_id();
println!("Current thread id: {}", thread_id);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl ThreadAbstraction for veecle_os::osal::std::thread::Thread

Source§

impl ThreadAbstraction for veecle_os::osal::embassy::thread::Thread