add thread test
This commit is contained in:
9
thread-test/Cargo.toml
Normal file
9
thread-test/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[package]
|
||||||
|
name = "thread-test"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Hatter Jiang@Pixelbook <jht5945@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
10
thread-test/src/main.rs
Normal file
10
thread-test/src/main.rs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
use std::thread;
|
||||||
|
|
||||||
|
// https://zhuanlan.zhihu.com/p/89716165
|
||||||
|
fn main() {
|
||||||
|
let child = thread::spawn(move || {
|
||||||
|
println!("Hello World!");
|
||||||
|
});
|
||||||
|
let _res = child.join().unwrap();
|
||||||
|
println!("Finished!");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user