aboutsummaryrefslogtreecommitdiff
path: root/build2/scheduler.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-02-20 11:09:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-20 11:09:26 +0200
commit6fd981a2a5b41e38f4b2e8f5798b431e4cdcf19b (patch)
treeb538f817bf9731701f24a27b2b9a5a9bd206910f /build2/scheduler.hxx
parent29f6e38b4f8d55f3da61fcd061c8b8ff3c5eaa00 (diff)
Initial work on deadlock detection support
Fun fact: In a serial build system a dependency cycle leads to an infinite loop/recursion. In a parallel -- to a deadlock. Still think build systems are fun?
Diffstat (limited to 'build2/scheduler.hxx')
-rw-r--r--build2/scheduler.hxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/build2/scheduler.hxx b/build2/scheduler.hxx
index d90a26f..aac9425 100644
--- a/build2/scheduler.hxx
+++ b/build2/scheduler.hxx
@@ -426,6 +426,13 @@ namespace build2
size_t stat_max_waiters_;
size_t stat_wait_collisions_;
+ // Progress counter.
+ //
+ // We increment it for each active->waiting->ready->active transition
+ // and it is used for deadlock detection (see deactivate()).
+ //
+ size_t progress_;
+
// Wait queue.
//
// A wait slot blocks a bunch of threads. When they are (all) unblocked,
@@ -456,7 +463,7 @@ namespace build2
//
// Each queue has its own mutex plus we have an atomic total count of the
// queued tasks. Note that it should only be modified while holding one
- // of the queue lock.
+ // of the queue locks.
//
atomic_count queued_task_count_;