diff options
Diffstat (limited to 'build2/scheduler.cxx')
-rw-r--r-- | build2/scheduler.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/build2/scheduler.cxx b/build2/scheduler.cxx index fdf4121..65684eb 100644 --- a/build2/scheduler.cxx +++ b/build2/scheduler.cxx @@ -388,6 +388,17 @@ namespace build2 return r; } + scheduler::monitor_guard scheduler:: + monitor (atomic_count& c, size_t t, function<size_t (size_t)> f) + { + assert (monitor_count_ == nullptr && t != 0); + monitor_count_ = &c; + monitor_tshold_.store (t, memory_order_relaxed); + monitor_init_ = c.load (memory_order_relaxed); + monitor_func_ = move (f); + return monitor_guard (this); + } + void scheduler:: activate_helper (lock& l) { |