From febcacdb5a60d37c2a56c9aad7b636be799940cd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 1 Dec 2017 09:21:42 +0200 Subject: Terminate waiting threads if coming off failed load phase In this case the build state may no longer be valid. --- build2/context.ixx | 80 ------------------------------------------------------ 1 file changed, 80 deletions(-) (limited to 'build2/context.ixx') diff --git a/build2/context.ixx b/build2/context.ixx index aee7e32..2e878d0 100644 --- a/build2/context.ixx +++ b/build2/context.ixx @@ -4,86 +4,6 @@ namespace build2 { - // phase_lock - // - inline phase_lock:: - phase_lock (run_phase p) - : p (p) - { - if (phase_lock* l = instance) - assert (l->p == p); - else - { - phase_mutex::instance.lock (p); - instance = this; - - //text << this_thread::get_id () << " phase acquire " << p; - } - } - - inline phase_lock:: - ~phase_lock () - { - if (instance == this) - { - instance = nullptr; - phase_mutex::instance.unlock (p); - - //text << this_thread::get_id () << " phase release " << p; - } - } - - // phase_unlock - // - inline phase_unlock:: - phase_unlock (bool u) - : l (u ? phase_lock::instance : nullptr) - { - if (u) - { - phase_lock::instance = nullptr; - phase_mutex::instance.unlock (l->p); - - //text << this_thread::get_id () << " phase unlock " << l->p; - } - } - - inline phase_unlock:: - ~phase_unlock () - { - if (l != nullptr) - { - phase_mutex::instance.lock (l->p); - phase_lock::instance = l; - - //text << this_thread::get_id () << " phase lock " << l->p; - } - } - - // phase_switch - // - inline phase_switch:: - phase_switch (run_phase n) - : o (phase), n (n) - { - phase_mutex::instance.relock (o, n); - phase_lock::instance->p = n; - - if (n == run_phase::load) // Note: load lock is exclusive. - load_generation++; - - //text << this_thread::get_id () << " phase switch " << o << " " << n; - } - - inline phase_switch:: - ~phase_switch () - { - phase_mutex::instance.relock (n, o); - phase_lock::instance->p = o; - - //text << this_thread::get_id () << " phase restore " << n << " " << o; - } - // wait_guard // inline wait_guard:: -- cgit v1.1