From b37f1aa6398065be806e6605a023189685669885 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 15 Feb 2017 03:55:15 +0200 Subject: Implement parallel match --- build2/scheduler.txx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'build2/scheduler.txx') diff --git a/build2/scheduler.txx b/build2/scheduler.txx index f53c044..c9d2d14 100644 --- a/build2/scheduler.txx +++ b/build2/scheduler.txx @@ -66,7 +66,7 @@ namespace build2 // If there is a spare active thread, wake up (or create) the helper // (unless someone already snatched it). // - if (queued_task_count_ != 0) + if (queued_task_count_.load (std::memory_order_consume) != 0) { lock l (mutex_); @@ -91,7 +91,7 @@ namespace build2 t.thunk (std::index_sequence_for ()); atomic_count& tc (*t.task_count); - if (--tc <= t.start_count) - s.resume (tc); // Resume a waiter, if any. + if (tc.fetch_sub (1, memory_order_release) - 1 <= t.start_count) + s.resume (tc); // Resume waiters, if any. } } -- cgit v1.1