diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-04-18 09:33:13 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-04-19 04:12:34 +0200 |
commit | 9920e41e1372229c52f74151af5f1570f32a489c (patch) | |
tree | 318f1524a46b753530c2dfa27680a12c9e12920a /libbuild2/algorithm.cxx | |
parent | 912ac87012ffc2fd0c6fb21823a0244c787ce5ba (diff) |
Cache "recipe is group_action" information, clear recipes after execution
Diffstat (limited to 'libbuild2/algorithm.cxx')
-rw-r--r-- | libbuild2/algorithm.cxx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx index 8ef88e4..287ab2e 100644 --- a/libbuild2/algorithm.cxx +++ b/libbuild2/algorithm.cxx @@ -1914,14 +1914,20 @@ namespace build2 ts = s.state = target_state::failed; } + // Clear the recipe to release any associated memory. Note that + // s.recipe_group_action may be used further (see, for example, + // group_state()) and should retain its value. + // + // + s.recipe = nullptr; + // Decrement the target count (see set_recipe() for details). // - if (a.inner ()) - { - recipe_function** f (s.recipe.target<recipe_function*> ()); - if (f == nullptr || *f != &group_action) - ctx.target_count.fetch_sub (1, memory_order_relaxed); - } + // Note that here we cannot rely on s.state being group because of the + // postponment logic (see excute_recipe() for details). + // + if (a.inner () && !s.recipe_group_action) + ctx.target_count.fetch_sub (1, memory_order_relaxed); // Decrement the task count (to count_executed) and wake up any threads // that might be waiting for this target. |