aboutsummaryrefslogtreecommitdiff
path: root/embassy-executor
diff options
context:
space:
mode:
authorxoviat <[email protected]>2025-12-12 18:51:51 -0600
committerxoviat <[email protected]>2025-12-12 18:51:51 -0600
commit74f5ec6efdd62969c6edad706ab3313f4d535a6a (patch)
tree72cc3c6a9572e673626c3503d2143f37d7661013 /embassy-executor
parente8d0b69e8c416cc2b9922acbf277b520d80f3134 (diff)
parent9f501479921ea9bbf5fef8ecdc9ac625225ed019 (diff)
Merge branch 'main' of https://github.com/embassy-rs/embassy into wpan
Diffstat (limited to 'embassy-executor')
-rw-r--r--embassy-executor/CHANGELOG.md1
-rw-r--r--embassy-executor/src/arch/std.rs15
-rw-r--r--embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr10
3 files changed, 22 insertions, 4 deletions
diff --git a/embassy-executor/CHANGELOG.md b/embassy-executor/CHANGELOG.md
index 5fbb8cf13..8f1db7de7 100644
--- a/embassy-executor/CHANGELOG.md
+++ b/embassy-executor/CHANGELOG.md
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
15- Added optional "earliest deadline first" EDF scheduling 15- Added optional "earliest deadline first" EDF scheduling
16- Migrate `cortex-ar` to `aarch32-cpu`. The feature name `arch-cortex-ar` remains the same and 16- Migrate `cortex-ar` to `aarch32-cpu`. The feature name `arch-cortex-ar` remains the same and
17 legacy ARM architectures are not supported. 17 legacy ARM architectures are not supported.
18- Added `run_until` to `arch-std` variant of `Executor`.
18 19
19## 0.9.1 - 2025-08-31 20## 0.9.1 - 2025-08-31
20 21
diff --git a/embassy-executor/src/arch/std.rs b/embassy-executor/src/arch/std.rs
index c62ab723b..d4057144e 100644
--- a/embassy-executor/src/arch/std.rs
+++ b/embassy-executor/src/arch/std.rs
@@ -55,11 +55,24 @@ mod thread {
55 /// 55 ///
56 /// This function never returns. 56 /// This function never returns.
57 pub fn run(&'static mut self, init: impl FnOnce(Spawner)) -> ! { 57 pub fn run(&'static mut self, init: impl FnOnce(Spawner)) -> ! {
58 self.run_until(init, || false);
59 unreachable!()
60 }
61
62 /// Run the executor until a flag is raised.
63 ///
64 /// This function is identical to `Executor::run()` apart from offering a `done` flag to stop execution.
65 pub fn run_until(&'static mut self, init: impl FnOnce(Spawner), mut done: impl FnMut() -> bool) {
58 init(self.inner.spawner()); 66 init(self.inner.spawner());
59 67
60 loop { 68 loop {
61 unsafe { self.inner.poll() }; 69 unsafe { self.inner.poll() };
62 self.signaler.wait() 70
71 if done() {
72 break;
73 }
74
75 self.signaler.wait();
63 } 76 }
64 } 77 }
65 } 78 }
diff --git a/embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr b/embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr
index 3c3c9503b..e5e069ade 100644
--- a/embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr
+++ b/embassy-executor/tests/ui/bad_return_impl_future_nightly.stderr
@@ -5,6 +5,10 @@ error[E0277]: task futures must resolve to `()` or `!`
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskReturnValue` is not implemented for `u32` 5 | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `TaskReturnValue` is not implemented for `u32`
6 | 6 |
7 = note: use `async fn` or change the return type to `impl Future<Output = ()>` 7 = note: use `async fn` or change the return type to `impl Future<Output = ()>`
8 = help: the following other types implement trait `TaskReturnValue`: 8help: the following other types implement trait `TaskReturnValue`
9 () 9 --> src/lib.rs
10 <fn() -> ! as HasOutput>::Output 10 |
11 | impl TaskReturnValue for () {}
12 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `()`
13 | impl TaskReturnValue for Never {}
14 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `<fn() -> ! as HasOutput>::Output`