diff options
Diffstat (limited to 'src/build.cc')
-rw-r--r-- | src/build.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/build.cc b/src/build.cc index 081c156..ad30719 100644 --- a/src/build.cc +++ b/src/build.cc @@ -11,11 +11,11 @@ #include <thread> #include <list> -#include "libctor.h" +#include "ctor.h" using namespace std::chrono_literals; -int build(const Settings& settings, +int build(const ctor::settings& settings, const std::string& name, const std::set<std::shared_ptr<Task>>& tasks, const std::set<std::shared_ptr<Task>>& all_tasks, @@ -84,7 +84,9 @@ int build(const Settings& settings, return task->run(); })); started_one = true; - std::this_thread::sleep_for(2ms); + // Make sure we don't start tasks on top of each other to prevent + // straining the disk. + std::this_thread::sleep_for(50ms); } for(auto process = processes.begin(); @@ -106,13 +108,9 @@ int build(const Settings& settings, break; } - if(started_one) + if(!started_one) // prevent polling too fast if no task is yet ready { - std::this_thread::sleep_for(2ms); - } - else - { - std::this_thread::sleep_for(200ms); + std::this_thread::sleep_for(10ms); } } @@ -156,7 +154,7 @@ std::set<std::shared_ptr<Task>> getDepTasks(std::shared_ptr<Task> task) } } -int build(const Settings& settings, +int build(const ctor::settings& settings, const std::string& name, const std::set<std::shared_ptr<Task>>& all_tasks, bool dryrun) @@ -194,7 +192,7 @@ int build(const Settings& settings, return 0; } -int build(const Settings& settings, +int build(const ctor::settings& settings, const std::string& name, const std::vector<Target>& targets, const std::set<std::shared_ptr<Task>>& all_tasks, |