aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-12-03 12:25:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-12-03 12:25:45 +0200
commit08b69435ef6912abbca4b2830eac9e78776ef4d5 (patch)
tree937be21b34674c95dd4bfec64eb682232fcc7fc3 /libbuild2/cc
parent90ad646d252b8354e329d2e1b048ee56499b6ccb (diff)
Fix lock/unlock order
Diffstat (limited to 'libbuild2/cc')
-rw-r--r--libbuild2/cc/common.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx
index c7ca7bc..2f55dcb 100644
--- a/libbuild2/cc/common.cxx
+++ b/libbuild2/cc/common.cxx
@@ -856,7 +856,6 @@ namespace build2
}
target_lock al (a != nullptr ? lock (act, *a, true) : target_lock ());
- target_lock sl (s != nullptr ? lock (act, *s, true) : target_lock ());
if (al && al.offset == target::offset_matched)
{
@@ -864,6 +863,8 @@ namespace build2
al.unlock ();
}
+ target_lock sl (s != nullptr ? lock (act, *s, true) : target_lock ());
+
if (sl && sl.offset == target::offset_matched)
{
assert ((*s)[act].rule == &file_rule::rule_match);