aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-06-19 15:52:33 -0500
committerxoviat <[email protected]>2023-06-19 15:52:33 -0500
commitaaad9068156305e5f6f41ee4013e025083bd0668 (patch)
tree67a08c8a512e8791433891a3b6deec813fc4c578 /embassy-executor
parent35083b262b364387713f4273649b62180123182c (diff)
parent3c70f799a28f5f28d84fa8ee8b4b232f5e9aad82 (diff)
Merge branch 'main' of https://github.com/embassy-rs/embassy into can
Diffstat (limited to 'embassy-executor')
-rw-r--r--embassy-executor/Cargo.toml2
-rw-r--r--embassy-executor/src/arch/cortex_m.rs15
2 files changed, 16 insertions, 1 deletions
diff --git a/embassy-executor/Cargo.toml b/embassy-executor/Cargo.toml
index ce032479d..1e5494ef8 100644
--- a/embassy-executor/Cargo.toml
+++ b/embassy-executor/Cargo.toml
@@ -65,7 +65,7 @@ embassy-macros = { version = "0.2.0", path = "../embassy-macros" }
65embassy-time = { version = "0.1.0", path = "../embassy-time", optional = true} 65embassy-time = { version = "0.1.0", path = "../embassy-time", optional = true}
66atomic-polyfill = "1.0.1" 66atomic-polyfill = "1.0.1"
67critical-section = "1.1" 67critical-section = "1.1"
68static_cell = "1.0" 68static_cell = "1.1"
69 69
70# arch-cortex-m dependencies 70# arch-cortex-m dependencies
71cortex-m = { version = "0.7.6", optional = true } 71cortex-m = { version = "0.7.6", optional = true }
diff --git a/embassy-executor/src/arch/cortex_m.rs b/embassy-executor/src/arch/cortex_m.rs
index d6a55c4c7..94c8134d6 100644
--- a/embassy-executor/src/arch/cortex_m.rs
+++ b/embassy-executor/src/arch/cortex_m.rs
@@ -205,5 +205,20 @@ mod interrupt {
205 205
206 executor.spawner().make_send() 206 executor.spawner().make_send()
207 } 207 }
208
209 /// Get a SendSpawner for this executor
210 ///
211 /// This returns a [`SendSpawner`] you can use to spawn tasks on this
212 /// executor.
213 ///
214 /// This MUST only be called on an executor that has already been spawned.
215 /// The function will panic otherwise.
216 pub fn spawner(&'static self) -> crate::SendSpawner {
217 if !self.started.load(Ordering::Acquire) {
218 panic!("InterruptExecutor::spawner() called on uninitialized executor.");
219 }
220 let executor = unsafe { (&*self.executor.get()).assume_init_ref() };
221 executor.spawner().make_send()
222 }
208 } 223 }
209} 224}