rt 0.19.1

A real-time operating system capable of full preemption
Documentation
#![no_main]
#![cfg_attr(target_os = "none", no_std)]

const NLOOPS: i32 = 5;

fn sleep_periodic(period: rt::tick::Utick) {
    rt::task::drop_privilege();
    let mut last_wake_tick = 0;

    for _ in 0..NLOOPS {
        rt::task::sleep_periodic(&mut last_wake_tick, period);
        let now = rt::tick::count();
        assert!((now - last_wake_tick) <= 1, "woke up at the wrong tick");
    }

    // Only the second task to finish will call rt::exit.
    rt::sem!(EXIT_SEM, 1);
    if !EXIT_SEM.try_wait() {
        rt::exit();
    }
}

const STACK_SIZE: usize = rt::stack::MIN * 8;

rt::task!(sleep_periodic(5), STACK_SIZE, 0);
rt::task!(sleep_periodic(10), STACK_SIZE, 1);