diff options
-rw-r--r-- | build2/scheduler.hxx | 3 | ||||
-rw-r--r-- | build2/scheduler.txx | 15 |
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; } |