Fix a non-termination bug.

This was a very silly bug. Instead of creating a particular atomic once
and cloning it, we created a new value for each worker.

Fixes #279
This commit is contained in:
Andrew Gallant
2016-12-12 06:55:49 -05:00
parent 6d346a09de
commit bb70f96743
2 changed files with 11 additions and 1 deletions

View File

@@ -767,12 +767,13 @@ impl WalkParallel {
// Create the workers and then wait for them to finish.
let num_waiting = Arc::new(AtomicUsize::new(0));
let num_quitting = Arc::new(AtomicUsize::new(0));
let quit_now = Arc::new(AtomicBool::new(false));
let mut handles = vec![];
for _ in 0..threads {
let worker = Worker {
f: mkf(),
queue: queue.clone(),
quit_now: Arc::new(AtomicBool::new(false)),
quit_now: quit_now.clone(),
is_waiting: false,
is_quitting: false,
num_waiting: num_waiting.clone(),