Skip to content

Commit 51aedbc

Browse files
committed
Use std:thread:hardware_concurrency, instead of Boost, to determine
available cores - backports bitcoin/bitcoin@937bf43
1 parent d447613 commit 51aedbc

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
@@ -19,6 +19,7 @@
1919
#include "utiltime.h"
2020

2121
#include <stdarg.h>
22+
#include <thread>
2223

2324
#include <boost/date_time/posix_time/posix_time.hpp>
2425

@@ -657,9 +658,5 @@ void SetThreadPriority(int nPriority)
657658

658659
int GetNumCores()
659660
{
660-
#if BOOST_VERSION >= 105600
661-
return boost::thread::physical_concurrency();
662-
#else // Must fall back to hardware_concurrency, which unfortunately counts virtual cores
663-
return boost::thread::hardware_concurrency();
664-
#endif
661+
return std::thread::hardware_concurrency();
665662
}

src/util.h

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

164164
/**
165-
* Return the number of physical cores available on the current system.
166-
* @note This does not count virtual cores, such as those provided by HyperThreading
167-
* when boost is newer than 1.56.
165+
* Return the number of cores available on the current system.
166+
* @note This does count virtual cores, such as those provided by HyperThreading.
168167
*/
169168
int GetNumCores();
170169

0 commit comments

Comments
 (0)