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:
Seamus Connor
2016-02-08 14:13:45 -07:00
parent 89ee19802b
commit ff94ef9254
3 changed files with 4 additions and 3 deletions

View File

@@ -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));
}
}