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)
This commit is contained in:
Dario Nieuwenhuis
2021-02-02 05:14:52 +01:00
parent d098952077
commit aeaa34d7a1
25 changed files with 495 additions and 377 deletions

View File

@ -49,11 +49,8 @@ fn main() -> ! {
let dp = stm32::Peripherals::take().unwrap();
let cp = cortex_m::peripheral::Peripherals::take().unwrap();
let executor = EXECUTOR.put(Executor::new(cortex_m::asm::sev));
executor.spawn(run(dp, cp)).unwrap();
loop {
executor.run();
//cortex_m::asm::wfe(); // wfe causes RTT to stop working on stm32
}
let executor = EXECUTOR.put(Executor::new());
executor.run(|spawner| {
unwrap!(spawner.spawn(run(dp, cp)));
});
}

View File

@ -59,11 +59,8 @@ fn main() -> ! {
let dp = stm32::Peripherals::take().unwrap();
let cp = cortex_m::peripheral::Peripherals::take().unwrap();
let executor = EXECUTOR.put(Executor::new(cortex_m::asm::sev));
executor.spawn(run(dp, cp)).unwrap();
loop {
executor.run();
//cortex_m::asm::wfe(); // wfe causes RTT to stop working on stm32
}
let executor = EXECUTOR.put(Executor::new());
executor.run(|spawner| {
unwrap!(spawner.spawn(run(dp, cp)));
});
}