#![no_main] #![cfg_attr(target_os = "none", no_std)] use core::sync::atomic::{AtomicU32, Ordering}; rt::sem!(H2READY); rt::sem!(HDONE); static H: AtomicU32 = AtomicU32::new(0); fn hydrogen() { if (H.fetch_add(1, Ordering::Relaxed) & 1) == 1 { H2READY.post(); } HDONE.wait(); } fn oxygen() { H2READY.wait(); make_water(); HDONE.post_n(2); } include!("water.rs");