From 2328704ca281eb3a7f2de524e4a1f1b7e4256d8c Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 5 Apr 2014 20:47:02 +0200 Subject: [PATCH] Fix compilation under cygwin since getloadavg() is not available there --- cli/threadexecutor.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/threadexecutor.cpp b/cli/threadexecutor.cpp index 968b348e9..fd93442ce 100644 --- a/cli/threadexecutor.cpp +++ b/cli/threadexecutor.cpp @@ -140,18 +140,22 @@ int ThreadExecutor::handleRead(int rpipe, unsigned int &result) bool ThreadExecutor::checkLoadAverage(size_t nchilds) { +#ifdef __CYGWIN__ // getloadavg() is unsupported on Cygwin. + return true; +#else if (!nchilds || !_settings._loadAverage) { return true; } - double sample; + double sample(0); if (getloadavg(&sample, 1) != 1) { - // disable load average cheking on getloadavg error + // disable load average checking on getloadavg error return true; } else if (sample < _settings._loadAverage) { return true; } return false; +#endif } unsigned int ThreadExecutor::check()