aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-06-20 09:08:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-06-20 09:08:13 +0200
commitc6b3f6659eda9b0b255ddc2d24accdd998b5938d (patch)
treeb2d8382f3500f1cf7756acdf24f8f68c7eb6b5a8
parentf94a2a2c8ead4895c9499ce7d768f7e153efccdf (diff)
Fix race in phase switch during failure
-rw-r--r--build2/context.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/build2/context.cxx b/build2/context.cxx
index 3d2a242..c704cd2 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -309,7 +309,10 @@ namespace build2
// longer be valid.
//
if (n == run_phase::load && uncaught_exception ())
+ {
+ mlock l (phase_mutex::instance.m_);
phase_mutex::instance.fail_ = true;
+ }
bool r (phase_mutex::instance.relock (n, o));
phase_lock::instance->p = o;