#![no_main] #![cfg_attr(target_os = "none", no_std)] use core::sync::atomic::{AtomicI32, Ordering}; static X: AtomicI32 = AtomicI32::new(0); fn foo() -> &'static str { X.fetch_add(1, Ordering::Relaxed); "hello world\n" } rt::lazy_lock!(HELLO, &'static str, foo); fn task0() { let _ = *HELLO; let _ = *HELLO; // Check that foo was only called once. assert_eq!(X.load(Ordering::Relaxed), 1); rt::trap(); } rt::task!(task0, rt::stack::MIN, 0);