diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-15 03:55:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-03-02 14:03:34 +0200 |
commit | b37f1aa6398065be806e6605a023189685669885 (patch) | |
tree | b9b32091e3d70a31852302b24c99ecb62465464a /build2/scheduler.txx | |
parent | a64b2ae2099346471ead988d5f2d383d55a9bf89 (diff) |
Implement parallel match
Diffstat (limited to 'build2/scheduler.txx')
-rw-r--r-- | build2/scheduler.txx | 6 |
1 files changed, 3 insertions, 3 deletions
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<A...> ()); 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. } } |