From abccaf9596461215fce0e32322133fb6c39be44f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 10 Feb 2017 08:15:48 +0200 Subject: Implement parallel error propagation, keep_going mode Keep going is the default but there is now the -s|--serial-stop that makes the driver run serially and stop at first error. Also fix some lockups, other minor improvements/features. --- build2/algorithm.ixx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'build2/algorithm.ixx') diff --git a/build2/algorithm.ixx b/build2/algorithm.ixx index 33a5fe0..6bc310f 100644 --- a/build2/algorithm.ixx +++ b/build2/algorithm.ixx @@ -71,10 +71,8 @@ namespace build2 if (!t.recipe (a)) match_impl (ml, a, t, true); - //@@ MT - // - t.dependents++; - dependency_count++; + t.dependents.fetch_add (1, std::memory_order_release); + dependency_count.fetch_add (1, std::memory_order_release); // text << "M " << t << ": " << t.dependents << " " << dependency_count; } @@ -86,11 +84,14 @@ namespace build2 assert (phase == run_phase::search_match); - //@@ MT - // - assert (t.dependents != 0 && dependency_count != 0); - t.dependents--; - dependency_count--; +#ifndef NDEBUG + size_t td (t.dependents--); + size_t gd (dependency_count--); + assert (td != 0 && gd != 0); +#else + t.dependents.fetch_sub (1, std::memory_order_release); + dependency_count.fetch_sub (1, std::memory_order_release); +#endif } inline void -- cgit v1.1