We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 822bbd2 commit f5f1ad5Copy full SHA for f5f1ad5
crates/treereduce/src/reduce.rs
@@ -504,6 +504,12 @@ fn dispatch<T: Check + Send + Sync>(
504
/// Main function for each thread
505
fn work<T: Check + Send + Sync>(ctx: &Ctx<T>, num_threads: usize) -> Result<(), ReductionError> {
506
static IDLE_THREADS: AtomicUsize = AtomicUsize::new(0);
507
+ // Since IDLE_THREADS is static, decrement for second and later passes
508
+ let idle = IDLE_THREADS.load(atomic::Ordering::Acquire);
509
+ if idle > 0 {
510
+ IDLE_THREADS.store(idle - 1, atomic::Ordering::Release)
511
+ }
512
+
513
let tctx = ThreadCtx::new(ctx);
514
let mut idle = false;
515
// Quit if all threads are idle and there are no remaining tasks
0 commit comments