diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-04-25 22:09:04 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-04-25 22:09:04 +0200 |
| commit | b27feb061936d191f456edc22b2f89d4fc172520 (patch) | |
| tree | fa1b61a274deff0360ab92b36a4bc24f8b50c329 /examples/stm32f3/src/bin/multiprio.rs | |
| parent | 52ed08cf9563b6b52e5991acd43614448b089850 (diff) | |
executor: fix unsoundness in InterruptExecutor::start.
The initial closure is not actually called in the interrupt, so this is
illegally sending non-Send futures to the interrupt.
Remove the closure, and return a SendSpawner instead.
Diffstat (limited to 'examples/stm32f3/src/bin/multiprio.rs')
| -rw-r--r-- | examples/stm32f3/src/bin/multiprio.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/stm32f3/src/bin/multiprio.rs b/examples/stm32f3/src/bin/multiprio.rs index 1c9401549..02380de72 100644 --- a/examples/stm32f3/src/bin/multiprio.rs +++ b/examples/stm32f3/src/bin/multiprio.rs | |||
| @@ -124,17 +124,15 @@ fn main() -> ! { | |||
| 124 | let irq = interrupt::take!(UART4); | 124 | let irq = interrupt::take!(UART4); |
| 125 | irq.set_priority(interrupt::Priority::P6); | 125 | irq.set_priority(interrupt::Priority::P6); |
| 126 | let executor = EXECUTOR_HIGH.put(InterruptExecutor::new(irq)); | 126 | let executor = EXECUTOR_HIGH.put(InterruptExecutor::new(irq)); |
| 127 | executor.start(|spawner| { | 127 | let spawner = executor.start(); |
| 128 | unwrap!(spawner.spawn(run_high())); | 128 | unwrap!(spawner.spawn(run_high())); |
| 129 | }); | ||
| 130 | 129 | ||
| 131 | // Medium-priority executor: SWI0_EGU0, priority level 7 | 130 | // Medium-priority executor: SWI0_EGU0, priority level 7 |
| 132 | let irq = interrupt::take!(UART5); | 131 | let irq = interrupt::take!(UART5); |
| 133 | irq.set_priority(interrupt::Priority::P7); | 132 | irq.set_priority(interrupt::Priority::P7); |
| 134 | let executor = EXECUTOR_MED.put(InterruptExecutor::new(irq)); | 133 | let executor = EXECUTOR_MED.put(InterruptExecutor::new(irq)); |
| 135 | executor.start(|spawner| { | 134 | let spawner = executor.start(); |
| 136 | unwrap!(spawner.spawn(run_med())); | 135 | unwrap!(spawner.spawn(run_med())); |
| 137 | }); | ||
| 138 | 136 | ||
| 139 | // Low priority executor: runs in thread mode, using WFE/SEV | 137 | // Low priority executor: runs in thread mode, using WFE/SEV |
| 140 | let executor = EXECUTOR_LOW.put(Executor::new()); | 138 | let executor = EXECUTOR_LOW.put(Executor::new()); |
