Fix compilation under cygwin since getloadavg() is not available there
This commit is contained in:
parent
456e33fc7b
commit
2328704ca2
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue