diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-05-12 10:46:21 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-05-12 16:30:12 +0200 |
commit | 88379eedeae654391711d8cdda17dfc2be6367ef (patch) | |
tree | 966ee03369b51013021600a2beea8334962ab2ec /libbuild2/scheduler.hxx | |
parent | 8b858c642ccab43050dcff2d8f98db469ac6dc1b (diff) |
Keep phase locked while working own queue
Diffstat (limited to 'libbuild2/scheduler.hxx')
-rw-r--r-- | libbuild2/scheduler.hxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libbuild2/scheduler.hxx b/libbuild2/scheduler.hxx index e1bb715..9556caa 100644 --- a/libbuild2/scheduler.hxx +++ b/libbuild2/scheduler.hxx @@ -125,6 +125,16 @@ namespace build2 return wait (0, task_count, wq); } + // As above but call lock.unlock() before suspending (can be used to + // unlock the phase). + // + template <typename L> + size_t + wait (size_t start_count, + const atomic_count& task_count, + L& lock, + work_queue = work_all); + // Mark the queue so that we don't work any tasks that may already be // there. In the normal "bunch of acync() calls followed by wait()" // cases this happens automatically but in special cases where async() @@ -846,6 +856,10 @@ namespace build2 static void queue (task_queue*) noexcept; + + private: + optional<size_t> + wait_impl (size_t, const atomic_count&, work_queue); }; } |