aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-02-27 16:01:54 +0100
committerEelco Dolstra <edolstra@gmail.com>2017-02-27 16:01:54 +0100
commit3fab1f04a7d9a5d8ca0f7faf071d5767f93c7e22 (patch)
tree316eba48571bb7bb06091cc41505596d89a30ef5
parent4f3fb34844eef457d910fbbb78fe676f696eeac5 (diff)
_SC_NPROCESSORS_ONLN -> std::thread::hardware_concurrency()
-rw-r--r--src/libstore/globals.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 474288b78..12e2a3cf4 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -2,9 +2,9 @@
#include "util.hh"
#include "archive.hh"
-#include <map>
#include <algorithm>
-#include <unistd.h>
+#include <map>
+#include <thread>
namespace nix {
@@ -42,11 +42,7 @@ Settings::Settings()
keepGoing = false;
tryFallback = false;
maxBuildJobs = 1;
- buildCores = 1;
-#ifdef _SC_NPROCESSORS_ONLN
- long res = sysconf(_SC_NPROCESSORS_ONLN);
- if (res > 0) buildCores = res;
-#endif
+ buildCores = std::max(1U, std::thread::hardware_concurrency());
readOnlyMode = false;
thisSystem = SYSTEM;
maxSilentTime = 0;