Merge pull request #100 from hughbe/sysconf-another
Fix another use of `sysconf` instead of platform independent c++ 11
diff --git a/lib/Commands/NinjaBuildCommand.cpp b/lib/Commands/NinjaBuildCommand.cpp
index fd746bd..e49a2b9 100644
--- a/lib/Commands/NinjaBuildCommand.cpp
+++ b/lib/Commands/NinjaBuildCommand.cpp
@@ -1943,8 +1943,8 @@
// FIXME: Do a serious analysis of scheduling, including ideally an active
// scheduler in the execution queue.
if (numJobsInParallel == 0) {
- long numCPUs = sysconf(_SC_NPROCESSORS_ONLN);
- if (numCPUs < 0) {
+ unsigned numCPUs = std::thread::hardware_concurrency();
+ if (numCPUs == 0) {
context.emitError("unable to detect number of CPUs (%s)",
strerror(errno));
return 1;