diff options
| author | Martin Marmsoler <[email protected]> | 2025-03-14 19:08:00 +0100 |
|---|---|---|
| committer | Martin Marmsoler <[email protected]> | 2025-03-14 19:08:50 +0100 |
| commit | edadc28f02f3f224680ca88f476d58bbbb106356 (patch) | |
| tree | b700c0dd63709b609ab5fdd5bc5cd27d76a0e57d /embassy-executor/src | |
| parent | 38f26137fc67beb874aa73c9a7ab2150d9f3d372 (diff) | |
Add possibility to get the id of a task to be able to use it with rtos-trace
Files: spawner.rs
Diffstat (limited to 'embassy-executor/src')
| -rw-r--r-- | embassy-executor/src/spawner.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/embassy-executor/src/spawner.rs b/embassy-executor/src/spawner.rs index 7e76a09c6..fdd3ce002 100644 --- a/embassy-executor/src/spawner.rs +++ b/embassy-executor/src/spawner.rs | |||
| @@ -34,6 +34,15 @@ impl<S> SpawnToken<S> { | |||
| 34 | } | 34 | } |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 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 | |||
| 37 | /// Return a SpawnToken that represents a failed spawn. | 46 | /// Return a SpawnToken that represents a failed spawn. |
| 38 | pub fn new_failed() -> Self { | 47 | pub fn new_failed() -> Self { |
| 39 | Self { | 48 | Self { |
