Skip to content

Instantly share code, notes, and snippets.

@jtriley-eth
Last active March 21, 2022 00:11
Show Gist options
  • Save jtriley-eth/b550b3b31559f011116594574a804157 to your computer and use it in GitHub Desktop.
Save jtriley-eth/b550b3b31559f011116594574a804157 to your computer and use it in GitHub Desktop.
// import `thread` module from the standard library
use std::thread;
// entry point of the program
fn main() {
// spawn a new thread with the `spawn` method in the `thread` module
thread::spawn(|| {
println!("hello from the spawned thread");
}
println!("hello from the main thread");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment