#![no_main] #![cfg_attr(target_os = "none", no_std)] rt::once_lock!(CELL, usize); rt::sem_binary!(SEM); fn task0() { assert!(CELL.get().is_none()); // Wait for task1 to set the value. SEM.wait(); assert_eq!(CELL.get(), Some(&12345)); rt::trap(); } fn task1() { let value = CELL.get_or_init(|| 12345); assert_eq!(value, &12345); SEM.post(); } rt::task!(task0, rt::stack::MIN, 0); rt::task!(task1, rt::stack::MIN, 1);