diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-29 14:34:16 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-29 14:34:16 +0200 |
commit | 7cd2c81a93aee9b19205f816bb475f82d9dbdea6 (patch) | |
tree | f58708fcfd0d0bd3681e8968edfaf97ed2a258e4 /build2/scheduler.txx | |
parent | 30dcb00062969f914e1c6e02070287f499e02fbf (diff) |
Add progress monitoring for serial execution
Diffstat (limited to 'build2/scheduler.txx')
-rw-r--r-- | build2/scheduler.txx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/build2/scheduler.txx b/build2/scheduler.txx index b62acdb..c7e6ef2 100644 --- a/build2/scheduler.txx +++ b/build2/scheduler.txx @@ -24,6 +24,21 @@ namespace build2 if (max_active_ == 1) { forward<F> (f) (forward<A> (a)...); + + // See if we need to call the monitor (see the concurrent version in + // execute() for details). + // + if (monitor_count_ != nullptr) + { + size_t v (monitor_count_->load (memory_order_relaxed)); + if (v != monitor_init_) + { + size_t t (monitor_tshold_.load (memory_order_relaxed)); + if (v > monitor_init_ ? (v >= t) : (v <= t)) + monitor_tshold_.store (monitor_func_ (v), memory_order_relaxed); + } + } + return false; } |