about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-02-27T15·01+0100
committerEelco Dolstra <edolstra@gmail.com>2017-02-27T15·01+0100
commit3fab1f04a7d9a5d8ca0f7faf071d5767f93c7e22 (patch)
tree316eba48571bb7bb06091cc41505596d89a30ef5 /src/libstore
parent4f3fb34844eef457d910fbbb78fe676f696eeac5 (diff)
_SC_NPROCESSORS_ONLN -> std::thread::hardware_concurrency()
Diffstat (limited to 'src/libstore')
-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 474288b7812c..12e2a3cf43dd 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;