From 3074c5e1409ad49c0793db6384ecbc6ac4ed33a9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 11 Dec 2020 07:07:36 +0200 Subject: Add search_locked() versions of search() functions --- libbuild2/algorithm.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libbuild2/algorithm.cxx') 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 + 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 (*pt), ulock ()}; + + return create_new_target_locked (t.ctx, pk); + } + const target* search_existing (context& ctx, const prerequisite_key& pk) { -- cgit v1.1