From 4176050cdd49c74b2abbb32ad4f8237bc9628cc4 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Thu, 20 Feb 2020 17:26:34 -0500 Subject: [PATCH] ignore: another simplification Again, thanks to @zsugabubus! --- crates/ignore/src/walk.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/ignore/src/walk.rs b/crates/ignore/src/walk.rs index 0502d366..6734788f 100644 --- a/crates/ignore/src/walk.rs +++ b/crates/ignore/src/walk.rs @@ -1195,7 +1195,6 @@ impl WalkParallel { // this. The best case scenario would be finding a way to use rayon // to do this. let (tx, rx) = channel::unbounded(); - let num_pending = Arc::new(AtomicUsize::new(0)); { let mut visitor = builder.build(); let mut paths = Vec::new().into_iter(); @@ -1233,7 +1232,6 @@ impl WalkParallel { } } }; - num_pending.fetch_add(1, Ordering::SeqCst); tx.send(Message::Work(Work { dent: dent, ignore: self.ig_root.clone(), @@ -1248,6 +1246,7 @@ impl WalkParallel { } // Create the workers and then wait for them to finish. let quit_now = Arc::new(AtomicBool::new(false)); + let num_pending = Arc::new(AtomicUsize::new(tx.len())); crossbeam_utils::thread::scope(|s| { let mut handles = vec![]; for _ in 0..threads {