From 74d54ca37f8e16abb93b35617b6121ae19cc8028 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 6 Feb 2017 10:43:39 +0200 Subject: Make scheduler::resume() call usable in serial execution --- build2/scheduler.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'build2') diff --git a/build2/scheduler.cxx b/build2/scheduler.cxx index d1fdf26..013bbbc 100644 --- a/build2/scheduler.cxx +++ b/build2/scheduler.cxx @@ -16,6 +16,8 @@ namespace build2 if (task_count <= start_count) return; + assert (max_active_ != 1); // Serial execution, nobody to wait for. + // See if we can run some of our own tasks. // // If we are waiting on someone else's task count then there migh still @@ -121,6 +123,9 @@ namespace build2 void scheduler:: resume (atomic_count& tc) { + if (max_active_ == 1) // Serial execution, nobody to wakeup. + return; + wait_slot& s ( wait_queue_[std::hash () (&tc) % wait_queue_size_]); -- cgit v1.1