Merge pull request #3969 from Murmele/task-id

Add possibility to get the id of a task to be able to use it with rtos-trace
This commit is contained in:
Ulf Lilleengen 2025-03-19 08:46:13 +01:00 committed by GitHub
commit 8987bf201a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,6 +34,15 @@ impl<S> SpawnToken<S> {
}
}
/// Returns the task id 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 {