aboutsummaryrefslogtreecommitdiff
path: root/build2/context.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-12-01 09:21:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-12-01 09:28:33 +0200
commitfebcacdb5a60d37c2a56c9aad7b636be799940cd (patch)
treeb04f92b4fb2125c6ee247e87a9f19fe8b34a9ff3 /build2/context.ixx
parent474d70d1dd7a60b5a0dccbe9c3ab1139a9ef31ac (diff)
Terminate waiting threads if coming off failed load phase
In this case the build state may no longer be valid.
Diffstat (limited to 'build2/context.ixx')
-rw-r--r--build2/context.ixx80
1 files changed, 0 insertions, 80 deletions
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::