diff --git a/src/lib.rs b/src/lib.rs index bf7dad3..c8b7c08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,7 @@ use std::{ time::{Duration, Instant}, }; -pub fn push_progress_bar( +pub fn start_progress_bar( done: &Arc, total: u64, size: u8, @@ -21,7 +21,6 @@ pub fn push_progress_bar( // let size = size.clone(); thread::spawn(move || { - let sleep = Duration::from_secs(1); loop { let done = done.load(Ordering::Relaxed); @@ -77,7 +76,7 @@ pub fn push_progress_bar( break; } print!("sleeping"); - thread::sleep(sleep); + thread::sleep(update_time); } }); } @@ -97,7 +96,7 @@ mod tests { let value = Arc::new(AtomicU64::from(0)); - push_progress_bar(&value, 100, 50, "Being silly", now, Duration::from_secs(1)); + start_progress_bar(&value, 100, 50, "Being silly", now, Duration::from_secs(1)); for _ in 0..=100 { value.fetch_add(1, Ordering::Relaxed);