aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-04-06 21:55:04 +0000
committerGitHub <[email protected]>2025-04-06 21:55:04 +0000
commitcee3b49344f47284cd2554c169aa3592929006da (patch)
tree095721fb83f947af27e0c7e896380b72d4c6c571 /embassy-executor
parent668f5d42c3b444dfd5921cadb9245be65a14bb40 (diff)
parent89f3566419a4987a5fa1420993322456c1849fef (diff)
Merge pull request #4049 from kaspar030/executor_id
embassy-executor: introduce `Executor::id()`, `Spawner::executor_id()`
Diffstat (limited to 'embassy-executor')
-rw-r--r--embassy-executor/src/raw/mod.rs5
-rw-r--r--embassy-executor/src/spawner.rs5
2 files changed, 10 insertions, 0 deletions
diff --git a/embassy-executor/src/raw/mod.rs b/embassy-executor/src/raw/mod.rs
index 5b1f33a0e..56faa911d 100644
--- a/embassy-executor/src/raw/mod.rs
+++ b/embassy-executor/src/raw/mod.rs
@@ -555,6 +555,11 @@ impl Executor {
555 pub fn spawner(&'static self) -> super::Spawner { 555 pub fn spawner(&'static self) -> super::Spawner {
556 super::Spawner::new(self) 556 super::Spawner::new(self)
557 } 557 }
558
559 /// Get a unique ID for this Executor.
560 pub fn id(&'static self) -> usize {
561 &self.inner as *const SyncExecutor as usize
562 }
558} 563}
559 564
560/// Wake a task by `TaskRef`. 565/// Wake a task by `TaskRef`.
diff --git a/embassy-executor/src/spawner.rs b/embassy-executor/src/spawner.rs
index 9817a2870..ff243081c 100644
--- a/embassy-executor/src/spawner.rs
+++ b/embassy-executor/src/spawner.rs
@@ -173,6 +173,11 @@ impl Spawner {
173 pub fn make_send(&self) -> SendSpawner { 173 pub fn make_send(&self) -> SendSpawner {
174 SendSpawner::new(&self.executor.inner) 174 SendSpawner::new(&self.executor.inner)
175 } 175 }
176
177 /// Return the unique ID of this Spawner's Executor.
178 pub fn executor_id(&self) -> usize {
179 self.executor.id()
180 }
176} 181}
177 182
178/// Handle to spawn tasks into an executor from any thread. 183/// Handle to spawn tasks into an executor from any thread.