From 2de571c17963d7820247860fd712d1103fecf8e6 Mon Sep 17 00:00:00 2001 From: "Hatter Jiang@Pixelbook" Date: Fri, 24 Jan 2020 17:21:50 +0800 Subject: [PATCH] add thread test --- thread-test/Cargo.toml | 9 +++++++++ thread-test/src/main.rs | 10 ++++++++++ 2 files changed, 19 insertions(+) create mode 100644 thread-test/Cargo.toml create mode 100644 thread-test/src/main.rs diff --git a/thread-test/Cargo.toml b/thread-test/Cargo.toml new file mode 100644 index 0000000..564b32d --- /dev/null +++ b/thread-test/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "thread-test" +version = "0.1.0" +authors = ["Hatter Jiang@Pixelbook "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/thread-test/src/main.rs b/thread-test/src/main.rs new file mode 100644 index 0000000..553f06b --- /dev/null +++ b/thread-test/src/main.rs @@ -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!"); +}