aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf-examples/src/bin/executor_fairness_test.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2021-02-02 05:14:52 +0100
committerDario Nieuwenhuis <[email protected]>2021-02-02 05:20:41 +0100
commitaeaa34d7a163b327643c08e299e1b40bb497c01c (patch)
tree6054344c8a7d990b910416a1002aded9ad4d10eb /embassy-nrf-examples/src/bin/executor_fairness_test.rs
parentd098952077b8fdc8426754151bb8064214a046fa (diff)
Executor API V2.
- It's no longer possible to call run() reentrantly from within a task (soundness issue) - it's now possible to spawn Send tasks across threads (SendSpawner, #37)
Diffstat (limited to 'embassy-nrf-examples/src/bin/executor_fairness_test.rs')
-rw-r--r--embassy-nrf-examples/src/bin/executor_fairness_test.rs17
1 files changed, 7 insertions, 10 deletions
diff --git a/embassy-nrf-examples/src/bin/executor_fairness_test.rs b/embassy-nrf-examples/src/bin/executor_fairness_test.rs
index 9b2c1bd26..1b9955739 100644
--- a/embassy-nrf-examples/src/bin/executor_fairness_test.rs
+++ b/embassy-nrf-examples/src/bin/executor_fairness_test.rs
@@ -61,14 +61,11 @@ fn main() -> ! {
61 unsafe { embassy::time::set_clock(rtc) }; 61 unsafe { embassy::time::set_clock(rtc) };
62 62
63 let alarm = ALARM.put(rtc.alarm0()); 63 let alarm = ALARM.put(rtc.alarm0());
64 let executor = EXECUTOR.put(Executor::new_with_alarm(alarm, cortex_m::asm::sev)); 64 let executor = EXECUTOR.put(Executor::new());
65 65 executor.set_alarm(alarm);
66 unwrap!(executor.spawn(run1())); 66 executor.run(|spawner| {
67 unwrap!(executor.spawn(run2())); 67 unwrap!(spawner.spawn(run1()));
68 unwrap!(executor.spawn(run3())); 68 unwrap!(spawner.spawn(run2()));
69 69 unwrap!(spawner.spawn(run3()));
70 loop { 70 });
71 executor.run();
72 cortex_m::asm::wfe();
73 }
74} 71}