diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-06 10:43:39 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-13 12:42:42 +0200 |
commit | 74d54ca37f8e16abb93b35617b6121ae19cc8028 (patch) | |
tree | a4c86c0d84c301aad16108a10e224b78fe2c8236 | |
parent | 0e4b975073a787ce3e5450173cf407a71bafd3a4 (diff) |
Make scheduler::resume() call usable in serial execution
-rw-r--r-- | build2/scheduler.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
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<atomic_count*> () (&tc) % wait_queue_size_]); |