Create Thread In Rust

[Solved] Create Thread In Rust | Rust - Code Explorer | yomemimo.com
Question : create thread in rust

Answered by : lovely-lemur-u9ps2kjyawrp

use std::thread;
use std::time::Duration;
fn main() { // create a thread thread::spawn(|| { for i in 0..5 { println!("hi number {} from the spawned thread!", i); } });
}

Source : https://www.koderhq.com/tutorial/rust/concurrency/ | Last Update : Sun, 13 Feb 22

Answers related to create thread in rust

Code Explorer Popular Question For Rust