aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-12-11 20:53:32 +0300
committerBoris Kolpackov <boris@codesynthesis.com>2020-12-14 09:30:44 +0200
commitca6a61f432f3ff0257e868bed36a58540623ab49 (patch)
treee3652b0376b9a6235aec6c32b5d9bd410e0507e5 /libbuild2/target.hxx
parent4e8e690640c1dc9ecc78edce1c2e11c28850bfa2 (diff)
Fix bug in create_new_target_locked()
Diffstat (limited to 'libbuild2/target.hxx')
-rw-r--r--libbuild2/target.hxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index e1d91e4..8c7ccee 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -147,6 +147,10 @@ namespace build2
const string* ext () const; // Return NULL if not specified.
const string& ext (string);
+ // As above but assume targets mutex is locked.
+ //
+ const string* ext_locked () const;
+
const dir_path&
out_dir () const {return out.empty () ? dir : out;}
@@ -284,6 +288,11 @@ namespace build2
target_key
key () const;
+ // As above but assume targets mutex is locked.
+ //
+ target_key
+ key_locked () const;
+
names
as_name () const;
@@ -811,6 +820,11 @@ namespace build2
inline bool
operator!= (const target& x, const target& y) {return !(x == y);}
+ // Note that if the targets mutex is locked, then calling this operator
+ // will lead to a deadlock. Instead, do:
+ //
+ // ... << t.key_locked () << ...
+ //
ostream&
operator<< (ostream&, const target&);
@@ -1385,7 +1399,7 @@ namespace build2
decl,
t));
- return pair<target&, bool> (p.first, p.second.owns_lock ());
+ return pair<target&, bool> (p.first, p.second);
}
// Note that the following versions always enter implied targets.