diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-08 07:42:41 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-13 12:42:42 +0200 |
commit | 5cefca444f7062c61cc9d118ffea5901e05186fd (patch) | |
tree | 879d608f9a9084c7eaa4e5cb8bcad5650d966730 /build2/target.ixx | |
parent | db2a696f810e41189bcdf5524696ff3d0cfbe5a9 (diff) |
Implement parallel operation execution
Diffstat (limited to 'build2/target.ixx')
-rw-r--r-- | build2/target.ixx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/build2/target.ixx b/build2/target.ixx index 19e0dfa..68a683a 100644 --- a/build2/target.ixx +++ b/build2/target.ixx @@ -25,6 +25,39 @@ namespace build2 e != nullptr ? optional<string> (*e) : nullopt}; } + inline target_state target:: + atomic_state () const + { + switch (task_count) + { + case target::count_unexecuted: return target_state::unknown; + case target::count_postponed: return target_state::postponed; + case target::count_executed: return synchronized_state (); + default: return target_state::busy; + } + } + + inline target_state target:: + synchronized_state () const + { + // We go an extra step and short-circuit to the target state even if the + // raw state is not group provided the recipe is group_recipe. + + if (state_ == target_state::group) + return group->state_; + + if (group == nullptr) + return state_; + + if (recipe_function* const* f = recipe_.target<recipe_function*> ()) + { + if (*f == &group_action) + return group->state_; + } + + return state_; + } + // prerequisite_member // inline prerequisite prerequisite_member:: |