blob: 85a2ac88bea979006d21e3f5068a146ca35c6333 [file] [log] [blame] [edit]
#[cfg(feature = "std")]
fn main() {
use std::thread;
use std::time::Duration;
let (sender, receiver) = oneshot::channel();
let t = thread::spawn(move || {
thread::sleep(Duration::from_millis(2));
sender.send(9u128).unwrap();
});
assert_eq!(receiver.recv_timeout(Duration::from_millis(100)), Ok(9));
t.join().unwrap();
}
#[cfg(not(feature = "std"))]
fn main() {
panic!("This example is only for when the \"sync\" feature is used");
}