Skip to content

Commit edadc28

Browse files
committed
Add possibility to get the id of a task to be able to use it with rtos-trace
Files: spawner.rs
1 parent 38f2613 commit edadc28

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

embassy-executor/src/spawner.rs

+9
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ impl<S> SpawnToken<S> {
3434
}
3535
}
3636

37+
/// Returns the task if available, otherwise 0
38+
/// This can be used in combination with rtos-trace to match task names with id's
39+
pub fn id(&self) -> u32 {
40+
match self.raw_task {
41+
None => 0,
42+
Some(t) => t.as_ptr() as u32,
43+
}
44+
}
45+
3746
/// Return a SpawnToken that represents a failed spawn.
3847
pub fn new_failed() -> Self {
3948
Self {

0 commit comments

Comments
 (0)