Fix compilation under cygwin since getloadavg() is not available there

This commit is contained in:
Alexander 2014-04-05 20:47:02 +02:00
parent 456e33fc7b
commit 2328704ca2
1 changed files with 6 additions and 2 deletions

View File

@ -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()