diff options
Diffstat (limited to 'threads/threads1.rs')
| -rw-r--r-- | threads/threads1.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/threads/threads1.rs b/threads/threads1.rs index c19151e..af97552 100644 --- a/threads/threads1.rs +++ b/threads/threads1.rs @@ -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)); } } |
