From 7cd2c81a93aee9b19205f816bb475f82d9dbdea6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 29 Jul 2017 14:34:16 +0200 Subject: Add progress monitoring for serial execution --- build2/scheduler.hxx | 3 ++- build2/scheduler.txx | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/build2/scheduler.hxx b/build2/scheduler.hxx index 9e057b1..70dbf04 100644 --- a/build2/scheduler.hxx +++ b/build2/scheduler.hxx @@ -619,7 +619,8 @@ namespace build2 // td.thunk (*this, ql, &td.data); - // See if we need to call the monitor. + // See if we need to call the monitor (see also the serial version + // in async()). // if (monitor_count_ != nullptr) { 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) (forward (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; } -- cgit v1.1