Rust中的并发
作者:互联网
std::thread
use std::{thread::{self, JoinHandle, sleep}, time::Duration};
fn main() -> std::io::Result<()> {
let jh: JoinHandle<i32> = thread::spawn(|| {
sleep(Duration::from_millis(3000));
88
});
let a: i32 = jh.join().unwrap();
println!("Hello, world! {}", a);
Ok(())
}
END
标签:std,thread,JoinHandle,并发,jh,Duration,sleep,Rust 来源: https://www.cnblogs.com/develon/p/14716656.html