Lesson 35 of 50 · rust
Threads and Concurrency
Duration: 18 minutes
Lesson 35 of 50 · rust
Duration: 18 minutes
std::thread to spawn native OS threads.\n\nrust\nuse std::thread;\n\nfn main() {\n let handle = thread::spawn(|| {\n for i in 1..5 {\n println!(\"Thread: {}\", i);\n }\n });\n for i in 5..10 {\n println!(\"Main: {}\", i);\n }\n handle.join().unwrap();\n}\n\n