#![no_main] #![cfg_attr(target_os = "none", no_std)] const ITERATIONS: u32 = 1000; rt::pool!(POOL, u32, 10); rt::queue!(QUEUE, rt::sync::PoolBox, 5); fn getter() { rt::task::drop_privilege(); for i in 0..ITERATIONS { QUEUE.push(POOL.alloc(i)); } } fn putter() { rt::task::drop_privilege(); for i in 0..ITERATIONS { assert!(*QUEUE.pop() == i, "*p has an unexpected value"); } rt::trap(); } fn timeout() { rt::task::sleep(100); panic!("timed out"); } rt::task!(getter, rt::stack::MIN * 2, 1); rt::task!(putter, rt::stack::MIN * 2, 1); rt::task!(timeout, rt::stack::MIN, 0);