diff options
| author | Ulf Lilleengen <[email protected]> | 2025-03-19 08:46:13 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-03-19 08:46:13 +0100 |
| commit | 8987bf201a401b252397312526bcb270c9b81f3a (patch) | |
| tree | d33af33b92d7052a906eba64173c5a15435b4796 /embassy-executor | |
| parent | 9d672c44d1dccaac039c656bc2986c4fcf9823c9 (diff) | |
| parent | e3b0581a876069fde325c82a14efc23f7cd6ad81 (diff) | |
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
Diffstat (limited to 'embassy-executor')
| -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..9817a2870 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 id 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 { |
