mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 16:40:42 +08:00
25 lines
460 B
Rust
25 lines
460 B
Rust
|
|
use std::thread;
|
|
use std::time::Duration;
|
|
|
|
fn main() {
|
|
|
|
println!("Hello, Rust world!");
|
|
|
|
let handle = thread::spawn(|| {
|
|
for i in 1..10 {
|
|
println!("hi number {} from the spawned thread!", i);
|
|
thread::sleep(Duration::from_millis(1));
|
|
}
|
|
});
|
|
|
|
handle.join().unwrap();
|
|
|
|
for i in 1..5 {
|
|
println!("hi number {} from the main thread!", i);
|
|
thread::sleep(Duration::from_millis(1));
|
|
}
|
|
}
|
|
|
|
|