From 3fab1f04a7d9a5d8ca0f7faf071d5767f93c7e22 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 27 Feb 2017 16:01:54 +0100 Subject: [PATCH] _SC_NPROCESSORS_ONLN -> std::thread::hardware_concurrency() --- src/libstore/globals.cc | 10 +++------- 1 file 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 #include -#include +#include +#include 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;