Skip to content

Commit 937bf43

Browse files
committed
Use std::thread::hardware_concurrency, instead of Boost, to determine available cores
1 parent c66adb2 commit 937bf43

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/util.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
#include <openssl/crypto.h>
7878
#include <openssl/rand.h>
7979
#include <openssl/conf.h>
80+
#include <thread>
8081

8182
// Application startup time (used for uptime calculation)
8283
const int64_t nStartupTime = GetTime();
@@ -891,11 +892,7 @@ bool SetupNetworking()
891892

892893
int GetNumCores()
893894
{
894-
#if BOOST_VERSION >= 105600
895-
return boost::thread::physical_concurrency();
896-
#else // Must fall back to hardware_concurrency, which unfortunately counts virtual cores
897-
return boost::thread::hardware_concurrency();
898-
#endif
895+
return std::thread::hardware_concurrency();
899896
}
900897

901898
std::string CopyrightHolders(const std::string& strPrefix)

src/util.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,8 @@ std::string HelpMessageGroup(const std::string& message);
295295
std::string HelpMessageOpt(const std::string& option, const std::string& message);
296296

297297
/**
298-
* Return the number of physical cores available on the current system.
299-
* @note This does not count virtual cores, such as those provided by HyperThreading
300-
* when boost is newer than 1.56.
298+
* Return the number of cores available on the current system.
299+
* @note This does count virtual cores, such as those provided by HyperThreading.
301300
*/
302301
int GetNumCores();
303302

0 commit comments

Comments
 (0)