diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-12-11 07:07:36 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-12-11 07:07:36 +0200 |
commit | 3074c5e1409ad49c0793db6384ecbc6ac4ed33a9 (patch) | |
tree | 256d707b43c3139fc7591d7ebd2a6c85456bc90b /libbuild2/algorithm.cxx | |
parent | b971493841a601041cac1f680e3828e8d223e6f2 (diff) |
Add search_locked() versions of search() functions
Diffstat (limited to 'libbuild2/algorithm.cxx')
-rw-r--r-- | libbuild2/algorithm.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx index d1a796d..f859eef 100644 --- a/libbuild2/algorithm.cxx +++ b/libbuild2/algorithm.cxx @@ -68,6 +68,17 @@ namespace build2 return create_new_target (t.ctx, pk); } + pair<target&, ulock> + search_locked (const target& t, const prerequisite_key& pk) + { + assert (t.ctx.phase == run_phase::match && !pk.proj); + + if (const target* pt = pk.tk.type->search (t, pk)) + return {const_cast<target&> (*pt), ulock ()}; + + return create_new_target_locked (t.ctx, pk); + } + const target* search_existing (context& ctx, const prerequisite_key& pk) { |