aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src/spawner.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-07-08 23:29:31 +0200
committerdiondokter <[email protected]>2025-08-29 13:20:18 +0200
commit658a52fb99e47d3d2f08ebf66335774930ad35ac (patch)
tree6e8f84b45f6a8de168c1eaccf5917af7b8fca991 /embassy-executor/src/spawner.rs
parentd3c84ee1d34329e61464c9acbedab74e9076ac0d (diff)
executor: do not store task IDs in RAM, we can get it from the pointer every time.
Diffstat (limited to 'embassy-executor/src/spawner.rs')
-rw-r--r--embassy-executor/src/spawner.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/embassy-executor/src/spawner.rs b/embassy-executor/src/spawner.rs
index 2909d19a0..7550e8ea4 100644
--- a/embassy-executor/src/spawner.rs
+++ b/embassy-executor/src/spawner.rs
@@ -36,12 +36,12 @@ impl<S> SpawnToken<S> {
36 } 36 }
37 } 37 }
38 38
39 /// Returns the task id if available, otherwise 0 39 /// Returns the task ID if available, otherwise 0
40 /// This can be used in combination with rtos-trace to match task names with id's 40 /// This can be used in combination with rtos-trace to match task names with IDs
41 pub fn id(&self) -> u32 { 41 pub fn id(&self) -> u32 {
42 match self.raw_task { 42 match self.raw_task {
43 None => 0, 43 None => 0,
44 Some(t) => t.as_ptr() as u32, 44 Some(t) => t.id(),
45 } 45 }
46 } 46 }
47 47
@@ -223,10 +223,8 @@ impl SpawnerTraceExt for Spawner {
223 223
224 match task { 224 match task {
225 Some(task) => { 225 Some(task) => {
226 // Set the name and ID when trace is enabled 226 // Set the name when trace is enabled
227 task.set_name(Some(name)); 227 task.set_name(Some(name));
228 let task_id = task.as_ptr() as u32;
229 task.set_id(task_id);
230 228
231 unsafe { self.executor.spawn(task) }; 229 unsafe { self.executor.spawn(task) };
232 Ok(()) 230 Ok(())