mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-05-28 18:36:10 +02:00
Moved away from deprecated thread::sleep_ms
Refactored to use thread::sleep and time::Duration and updated link in README.md
This commit is contained in:
parent
89ee19802b
commit
ff94ef9254
Binary file not shown.
|
@ -6,6 +6,7 @@
|
|||
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
struct JobStatus {
|
||||
jobs_completed: u32,
|
||||
|
@ -16,13 +17,13 @@ fn main() {
|
|||
let status_shared = status.clone();
|
||||
thread::spawn(move || {
|
||||
for _ in 0..10 {
|
||||
thread::sleep_ms(250);
|
||||
thread::sleep(Duration::from_millis(250));
|
||||
status_shared.jobs_completed += 1;
|
||||
}
|
||||
});
|
||||
while status.jobs_completed < 10 {
|
||||
println!("waiting... ");
|
||||
thread::sleep_ms(500);
|
||||
thread::sleep(Duration::from_millis(500));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue