From 937bf4335bc58c443645dc29b8d7ceadc81e74e5 Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 25 Apr 2017 09:34:23 +0800 Subject: [PATCH] Use std::thread::hardware_concurrency, instead of Boost, to determine available cores --- src/util.cpp | 7 ++----- src/util.h | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index a3e4b0acfb..9305491883 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -77,6 +77,7 @@ #include #include #include +#include // Application startup time (used for uptime calculation) const int64_t nStartupTime = GetTime(); @@ -891,11 +892,7 @@ bool SetupNetworking() int GetNumCores() { -#if BOOST_VERSION >= 105600 - return boost::thread::physical_concurrency(); -#else // Must fall back to hardware_concurrency, which unfortunately counts virtual cores - return boost::thread::hardware_concurrency(); -#endif + return std::thread::hardware_concurrency(); } std::string CopyrightHolders(const std::string& strPrefix) diff --git a/src/util.h b/src/util.h index 3cc4c26817..bef22f8eb2 100644 --- a/src/util.h +++ b/src/util.h @@ -295,9 +295,8 @@ std::string HelpMessageGroup(const std::string& message); std::string HelpMessageOpt(const std::string& option, const std::string& message); /** - * Return the number of physical cores available on the current system. - * @note This does not count virtual cores, such as those provided by HyperThreading - * when boost is newer than 1.56. + * Return the number of cores available on the current system. + * @note This does count virtual cores, such as those provided by HyperThreading. */ int GetNumCores();