From 658a52fb99e47d3d2f08ebf66335774930ad35ac Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Tue, 8 Jul 2025 23:29:31 +0200 Subject: executor: do not store task IDs in RAM, we can get it from the pointer every time. --- embassy-executor/src/spawner.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'embassy-executor/src/spawner.rs') 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 SpawnToken { } } - /// Returns the task id if available, otherwise 0 - /// This can be used in combination with rtos-trace to match task names with id's + /// Returns the task ID if available, otherwise 0 + /// This can be used in combination with rtos-trace to match task names with IDs pub fn id(&self) -> u32 { match self.raw_task { None => 0, - Some(t) => t.as_ptr() as u32, + Some(t) => t.id(), } } @@ -223,10 +223,8 @@ impl SpawnerTraceExt for Spawner { match task { Some(task) => { - // Set the name and ID when trace is enabled + // Set the name when trace is enabled task.set_name(Some(name)); - let task_id = task.as_ptr() as u32; - task.set_id(task_id); unsafe { self.executor.spawn(task) }; Ok(()) -- cgit