embassy/examples/nrf/src/bin/executor_fairness_test.rs
Dario Nieuwenhuis de016e8456 Remove trait_alias, allow(incomplete_features).
trait_alias seems unused. no idea why it's there.
2021-09-03 17:00:58 +02:00

44 lines
845 B
Rust

#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#[path = "../example_common.rs"]
mod example_common;
use example_common::*;
use core::task::Poll;
use embassy::executor::Spawner;
use embassy::time::{Duration, Instant, Timer};
use embassy_nrf::Peripherals;
#[embassy::task]
async fn run1() {
loop {
info!("DING DONG");
Timer::after(Duration::from_ticks(16000)).await;
}
}
#[embassy::task]
async fn run2() {
loop {
Timer::at(Instant::from_ticks(0)).await;
}
}
#[embassy::task]
async fn run3() {
futures::future::poll_fn(|cx| {
cx.waker().wake_by_ref();
Poll::<()>::Pending
})
.await;
}
#[embassy::main]
async fn main(spawner: Spawner, _p: Peripherals) {
unwrap!(spawner.spawn(run1()));
unwrap!(spawner.spawn(run2()));
unwrap!(spawner.spawn(run3()));
}