aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-07-29 14:34:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-07-29 14:34:16 +0200
commit7cd2c81a93aee9b19205f816bb475f82d9dbdea6 (patch)
treef58708fcfd0d0bd3681e8968edfaf97ed2a258e4
parent30dcb00062969f914e1c6e02070287f499e02fbf (diff)
Add progress monitoring for serial execution
-rw-r--r--build2/scheduler.hxx3
-rw-r--r--build2/scheduler.txx15
2 files changed, 17 insertions, 1 deletions
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> (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;
}