Add possibility to get the id of a task to be able to use it with rtos-trace

Files: spawner.rs
This commit is contained in:
Martin Marmsoler 2025-03-14 19:08:00 +01:00
parent 38f26137fc
commit edadc28f02

View File

@ -34,6 +34,15 @@ impl<S> SpawnToken<S> {
}
}
/// Returns the task if available, otherwise 0
/// This can be used in combination with rtos-trace to match task names with id's
pub fn id(&self) -> u32 {
match self.raw_task {
None => 0,
Some(t) => t.as_ptr() as u32,
}
}
/// Return a SpawnToken that represents a failed spawn.
pub fn new_failed() -> Self {
Self {