#![no_main] #![cfg_attr(target_os = "none", no_std)] const N: i32 = 10; rt::notify!(NOTE); fn notifier() { rt::task::drop_privilege(); for _ in 0..N { rt::task::sleep(5); NOTE.add(1); } rt::task::sleep(15); NOTE.post(); } fn waiter() { rt::task::drop_privilege(); for _ in 0..N { assert_eq!( NOTE.timed_wait_clear(1, 10).expect("wait timed out"), 1, "wait returned the wrong value" ); } assert!(NOTE.timed_wait(10).is_none(), "wait didn't time out"); rt::trap(); } const STACK_SIZE: usize = rt::stack::MIN * 8; rt::task!(notifier, rt::stack::MIN, 0); rt::task!(waiter, STACK_SIZE, 0);