1 2 3 4 5 6 7 8 9 10 11 12 13
use procspawn::{self, spawn}; use std::thread; use std::time::Duration; fn main() { procspawn::init(); let handle = spawn((), |()| { thread::sleep(Duration::from_secs(10)); }); println!("result: {:?}", handle.join_timeout(Duration::from_secs(1))); }