Skip to content

Commit 2328704

Browse files
AlexanderAlexander
authored andcommitted
Fix compilation under cygwin since getloadavg() is not available there
1 parent 456e33f commit 2328704

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cli/threadexecutor.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,22 @@ int ThreadExecutor::handleRead(int rpipe, unsigned int &result)
140140

141141
bool ThreadExecutor::checkLoadAverage(size_t nchilds)
142142
{
143+
#ifdef __CYGWIN__ // getloadavg() is unsupported on Cygwin.
144+
return true;
145+
#else
143146
if (!nchilds || !_settings._loadAverage) {
144147
return true;
145148
}
146149

147-
double sample;
150+
double sample(0);
148151
if (getloadavg(&sample, 1) != 1) {
149-
// disable load average cheking on getloadavg error
152+
// disable load average checking on getloadavg error
150153
return true;
151154
} else if (sample < _settings._loadAverage) {
152155
return true;
153156
}
154157
return false;
158+
#endif
155159
}
156160

157161
unsigned int ThreadExecutor::check()

0 commit comments

Comments
 (0)