diff options
| author | James Munns <[email protected]> | 2025-04-01 14:23:39 +0200 |
|---|---|---|
| committer | James Munns <[email protected]> | 2025-04-01 14:23:39 +0200 |
| commit | c3efb85b85eece9f706d232888e0fb70ee1270e4 (patch) | |
| tree | 8462989fd5e3b47d24e5bf4dcede0c2ce46424e2 /embassy-executor | |
| parent | 8a8e4500531342001977cdc99d6d107dd84be8e1 (diff) | |
Fix task_end callback
Diffstat (limited to 'embassy-executor')
| -rw-r--r-- | embassy-executor/src/raw/mod.rs | 5 | ||||
| -rw-r--r-- | embassy-executor/src/raw/trace.rs | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs index 73f4f00ee..5b1f33a0e 100644 --- a/embassy-executor/src/raw/mod.rs +++ b/embassy-executor/src/raw/mod.rs | |||
| @@ -219,6 +219,9 @@ impl<F: Future + 'static> TaskStorage<F> { | |||
| 219 | let mut cx = Context::from_waker(&waker); | 219 | let mut cx = Context::from_waker(&waker); |
| 220 | match future.poll(&mut cx) { | 220 | match future.poll(&mut cx) { |
| 221 | Poll::Ready(_) => { | 221 | Poll::Ready(_) => { |
| 222 | #[cfg(feature = "trace")] | ||
| 223 | let exec_ptr: *const SyncExecutor = this.raw.executor.load(Ordering::Relaxed); | ||
| 224 | |||
| 222 | // As the future has finished and this function will not be called | 225 | // As the future has finished and this function will not be called |
| 223 | // again, we can safely drop the future here. | 226 | // again, we can safely drop the future here. |
| 224 | this.future.drop_in_place(); | 227 | this.future.drop_in_place(); |
| @@ -232,7 +235,7 @@ impl<F: Future + 'static> TaskStorage<F> { | |||
| 232 | this.raw.state.despawn(); | 235 | this.raw.state.despawn(); |
| 233 | 236 | ||
| 234 | #[cfg(feature = "trace")] | 237 | #[cfg(feature = "trace")] |
| 235 | trace::task_end(self, &task); | 238 | trace::task_end(exec_ptr, &p); |
| 236 | } | 239 | } |
| 237 | Poll::Pending => {} | 240 | Poll::Pending => {} |
| 238 | } | 241 | } |
diff --git a/embassy-executor/src/raw/trace.rs b/embassy-executor/src/raw/trace.rs index 0952a9bc0..56724b0bb 100644 --- a/embassy-executor/src/raw/trace.rs +++ b/embassy-executor/src/raw/trace.rs | |||
| @@ -84,6 +84,7 @@ | |||
| 84 | //! 5. The executor has finished polling tasks. `_embassy_trace_executor_idle` is called. | 84 | //! 5. The executor has finished polling tasks. `_embassy_trace_executor_idle` is called. |
| 85 | 85 | ||
| 86 | #![allow(unused)] | 86 | #![allow(unused)] |
| 87 | |||
| 87 | use crate::raw::{SyncExecutor, TaskRef}; | 88 | use crate::raw::{SyncExecutor, TaskRef}; |
| 88 | 89 | ||
| 89 | #[cfg(not(feature = "rtos-trace"))] | 90 | #[cfg(not(feature = "rtos-trace"))] |
| @@ -163,10 +164,10 @@ pub(crate) fn task_new(executor: &SyncExecutor, task: &TaskRef) { | |||
| 163 | } | 164 | } |
| 164 | 165 | ||
| 165 | #[inline] | 166 | #[inline] |
| 166 | pub(crate) fn task_end(executor: &SyncExecutor, task: &TaskRef) { | 167 | pub(crate) fn task_end(executor: *const SyncExecutor, task: &TaskRef) { |
| 167 | #[cfg(not(feature = "rtos-trace"))] | 168 | #[cfg(not(feature = "rtos-trace"))] |
| 168 | unsafe { | 169 | unsafe { |
| 169 | _embassy_trace_task_end(executor as *const _ as u32, task.as_ptr() as u32) | 170 | _embassy_trace_task_end(executor as u32, task.as_ptr() as u32) |
| 170 | } | 171 | } |
| 171 | } | 172 | } |
| 172 | 173 | ||
