1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-03-03 14:32:22 +02:00

ignore: another simplification

Again, thanks to @zsugabubus!
This commit is contained in:
Andrew Gallant 2020-02-20 17:26:34 -05:00
parent 109460fce2
commit 4176050cdd
No known key found for this signature in database
GPG Key ID: B2E3A4923F8B0D44

View File

@ -1195,7 +1195,6 @@ impl WalkParallel {
// this. The best case scenario would be finding a way to use rayon // this. The best case scenario would be finding a way to use rayon
// to do this. // to do this.
let (tx, rx) = channel::unbounded(); let (tx, rx) = channel::unbounded();
let num_pending = Arc::new(AtomicUsize::new(0));
{ {
let mut visitor = builder.build(); let mut visitor = builder.build();
let mut paths = Vec::new().into_iter(); 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 { tx.send(Message::Work(Work {
dent: dent, dent: dent,
ignore: self.ig_root.clone(), ignore: self.ig_root.clone(),
@ -1248,6 +1246,7 @@ impl WalkParallel {
} }
// Create the workers and then wait for them to finish. // Create the workers and then wait for them to finish.
let quit_now = Arc::new(AtomicBool::new(false)); let quit_now = Arc::new(AtomicBool::new(false));
let num_pending = Arc::new(AtomicUsize::new(tx.len()));
crossbeam_utils::thread::scope(|s| { crossbeam_utils::thread::scope(|s| {
let mut handles = vec![]; let mut handles = vec![];
for _ in 0..threads { for _ in 0..threads {