aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor/src/arch
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-executor/src/arch')
-rw-r--r--embassy-executor/src/arch/cortex_m.rs5
-rw-r--r--embassy-executor/src/arch/wasm.rs5
2 files changed, 5 insertions, 5 deletions
diff --git a/embassy-executor/src/arch/cortex_m.rs b/embassy-executor/src/arch/cortex_m.rs
index 0806a22ab..fde862f3c 100644
--- a/embassy-executor/src/arch/cortex_m.rs
+++ b/embassy-executor/src/arch/cortex_m.rs
@@ -1,5 +1,3 @@
1const THREAD_PENDER: usize = usize::MAX;
2
3#[export_name = "__pender"] 1#[export_name = "__pender"]
4#[cfg(any(feature = "executor-thread", feature = "executor-interrupt"))] 2#[cfg(any(feature = "executor-thread", feature = "executor-interrupt"))]
5fn __pender(context: *mut ()) { 3fn __pender(context: *mut ()) {
@@ -48,13 +46,14 @@ fn __pender(context: *mut ()) {
48pub use thread::*; 46pub use thread::*;
49#[cfg(feature = "executor-thread")] 47#[cfg(feature = "executor-thread")]
50mod thread { 48mod thread {
49 pub(super) const THREAD_PENDER: usize = usize::MAX;
50
51 use core::arch::asm; 51 use core::arch::asm;
52 use core::marker::PhantomData; 52 use core::marker::PhantomData;
53 53
54 #[cfg(feature = "nightly")] 54 #[cfg(feature = "nightly")]
55 pub use embassy_macros::main_cortex_m as main; 55 pub use embassy_macros::main_cortex_m as main;
56 56
57 use crate::arch::THREAD_PENDER;
58 use crate::{raw, Spawner}; 57 use crate::{raw, Spawner};
59 58
60 /// Thread mode executor, using WFE/SEV. 59 /// Thread mode executor, using WFE/SEV.
diff --git a/embassy-executor/src/arch/wasm.rs b/embassy-executor/src/arch/wasm.rs
index 934fd69e5..15aed867a 100644
--- a/embassy-executor/src/arch/wasm.rs
+++ b/embassy-executor/src/arch/wasm.rs
@@ -73,9 +73,10 @@ mod thread {
73 pub fn start(&'static mut self, init: impl FnOnce(Spawner)) { 73 pub fn start(&'static mut self, init: impl FnOnce(Spawner)) {
74 unsafe { 74 unsafe {
75 let executor = &self.inner; 75 let executor = &self.inner;
76 self.ctx.closure.write(Closure::new(move |_| { 76 let future = Closure::new(move |_| {
77 executor.poll(); 77 executor.poll();
78 })); 78 });
79 self.ctx.closure.write_in_place(|| future);
79 init(self.inner.spawner()); 80 init(self.inner.spawner());
80 } 81 }
81 } 82 }