#![no_main] #![cfg_attr(target_os = "none", no_std)] use core::sync::atomic::Ordering; use atomic_float::AtomicF32; static V: AtomicF32 = AtomicF32::new(0.0); fn f(arg: u32) { rt::task::drop_privilege(); let mut x = 0.0f32; let a = arg as f32; loop { x += a; V.store(x, Ordering::Relaxed); rt::task::yield_now(); } } fn timeout() { rt::task::drop_privilege(); rt::task::sleep(100); V.load(Ordering::Relaxed); rt::trap(); } const STACK_SIZE: usize = rt::stack::FP_MIN.next_power_of_two(); rt::task!(f(1), STACK_SIZE, 1); rt::task!(f(2), STACK_SIZE, 1); rt::task!(timeout, rt::stack::MIN, 0);