diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-06 16:23:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-06 16:23:59 +0200 |
commit | ade1111af0e0d253418c0707ad4e15b71a191348 (patch) | |
tree | 91e283cbf38abb50815cec931f95328ca4de2b11 /libbuild2/scheduler.hxx | |
parent | 998d8ef439fd759e5c09a14729ad9748b58f55a0 (diff) |
Implement general deadlock detection via monitoring thread
Diffstat (limited to 'libbuild2/scheduler.hxx')
-rw-r--r-- | libbuild2/scheduler.hxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libbuild2/scheduler.hxx b/libbuild2/scheduler.hxx index 09c9e02..af1deba 100644 --- a/libbuild2/scheduler.hxx +++ b/libbuild2/scheduler.hxx @@ -440,7 +440,18 @@ namespace build2 // We increment it for each active->waiting->ready->active transition // and it is used for deadlock detection (see deactivate()). // - size_t progress_; + // Note that it still serves our purpose even if the value wraps around + // (e.g., on a 32-bit platform). + // + atomic_count progress_; + + // Deadlock detection. + // + std::thread dead_thread_; + std::condition_variable dead_condv_; + + static void* + deadlock_monitor (void*); // Wait queue. // |