Merge pull request #4049 from kaspar030/executor_id
embassy-executor: introduce `Executor::id()`, `Spawner::executor_id()`
This commit is contained in:
commit
cee3b49344
@ -555,6 +555,11 @@ impl Executor {
|
|||||||
pub fn spawner(&'static self) -> super::Spawner {
|
pub fn spawner(&'static self) -> super::Spawner {
|
||||||
super::Spawner::new(self)
|
super::Spawner::new(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get a unique ID for this Executor.
|
||||||
|
pub fn id(&'static self) -> usize {
|
||||||
|
&self.inner as *const SyncExecutor as usize
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wake a task by `TaskRef`.
|
/// Wake a task by `TaskRef`.
|
||||||
|
|||||||
@ -173,6 +173,11 @@ impl Spawner {
|
|||||||
pub fn make_send(&self) -> SendSpawner {
|
pub fn make_send(&self) -> SendSpawner {
|
||||||
SendSpawner::new(&self.executor.inner)
|
SendSpawner::new(&self.executor.inner)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return the unique ID of this Spawner's Executor.
|
||||||
|
pub fn executor_id(&self) -> usize {
|
||||||
|
self.executor.id()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle to spawn tasks into an executor from any thread.
|
/// Handle to spawn tasks into an executor from any thread.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user