diff options
| author | James Munns <[email protected]> | 2025-04-01 14:06:04 +0200 |
|---|---|---|
| committer | James Munns <[email protected]> | 2025-04-01 14:06:04 +0200 |
| commit | 882e2180a4ec7f448ea4ddaccf2a65e6757654c7 (patch) | |
| tree | 0241b22d69c03f2ea9b55343259839570ec9255b /embassy-executor/src/raw/mod.rs | |
| parent | a44abaf7e4562fa5393087fd845bf0d02141325b (diff) | |
Add docs, add `task_end` trace point
Diffstat (limited to 'embassy-executor/src/raw/mod.rs')
| -rw-r--r-- | embassy-executor/src/raw/mod.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs index e38a2af66..73f4f00ee 100644 --- a/embassy-executor/src/raw/mod.rs +++ b/embassy-executor/src/raw/mod.rs | |||
| @@ -138,6 +138,12 @@ impl TaskRef { | |||
| 138 | pub(crate) fn as_ptr(self) -> *const TaskHeader { | 138 | pub(crate) fn as_ptr(self) -> *const TaskHeader { |
| 139 | self.ptr.as_ptr() | 139 | self.ptr.as_ptr() |
| 140 | } | 140 | } |
| 141 | |||
| 142 | /// Get the ID for a task | ||
| 143 | #[cfg(feature = "trace")] | ||
| 144 | pub fn as_id(self) -> u32 { | ||
| 145 | self.ptr.as_ptr() as u32 | ||
| 146 | } | ||
| 141 | } | 147 | } |
| 142 | 148 | ||
| 143 | /// Raw storage in which a task can be spawned. | 149 | /// Raw storage in which a task can be spawned. |
| @@ -224,6 +230,9 @@ impl<F: Future + 'static> TaskStorage<F> { | |||
| 224 | // Make sure we despawn last, so that other threads can only spawn the task | 230 | // Make sure we despawn last, so that other threads can only spawn the task |
| 225 | // after we're done with it. | 231 | // after we're done with it. |
| 226 | this.raw.state.despawn(); | 232 | this.raw.state.despawn(); |
| 233 | |||
| 234 | #[cfg(feature = "trace")] | ||
| 235 | trace::task_end(self, &task); | ||
| 227 | } | 236 | } |
| 228 | Poll::Pending => {} | 237 | Poll::Pending => {} |
| 229 | } | 238 | } |
| @@ -420,6 +429,9 @@ impl SyncExecutor { | |||
| 420 | /// | 429 | /// |
| 421 | /// Same as [`Executor::poll`], plus you must only call this on the thread this executor was created. | 430 | /// Same as [`Executor::poll`], plus you must only call this on the thread this executor was created. |
| 422 | pub(crate) unsafe fn poll(&'static self) { | 431 | pub(crate) unsafe fn poll(&'static self) { |
| 432 | #[cfg(feature = "trace")] | ||
| 433 | trace::poll_start(self); | ||
| 434 | |||
| 423 | self.run_queue.dequeue_all(|p| { | 435 | self.run_queue.dequeue_all(|p| { |
| 424 | let task = p.header(); | 436 | let task = p.header(); |
| 425 | 437 | ||
