mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Gracefully cast from std:🧵:hardware_concurrency
This commit is contained in:
committed by
Tom Ritchford
parent
2264ae9247
commit
8caae219cf
@@ -56,7 +56,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
explicit Workers (Callback& callback,
|
explicit Workers (Callback& callback,
|
||||||
String const& threadNames = "Worker",
|
String const& threadNames = "Worker",
|
||||||
int numberOfThreads = std::thread::hardware_concurrency());
|
int numberOfThreads =
|
||||||
|
static_cast<int>(std::thread::hardware_concurrency()));
|
||||||
|
|
||||||
~Workers ();
|
~Workers ();
|
||||||
|
|
||||||
|
|||||||
@@ -226,18 +226,8 @@ public:
|
|||||||
}
|
}
|
||||||
else if (c == 0)
|
else if (c == 0)
|
||||||
{
|
{
|
||||||
c = std::thread::hardware_concurrency();
|
c = static_cast<int>(std::thread::hardware_concurrency());
|
||||||
|
c = 2 + std::min (c, 4); // I/O will bottleneck
|
||||||
// VFALCO NOTE According to boost, hardware_concurrency cannot return
|
|
||||||
// negative numbers/
|
|
||||||
//
|
|
||||||
if (c < 0)
|
|
||||||
c = 2; // VFALCO NOTE Why 2?
|
|
||||||
|
|
||||||
if (c > 4) // I/O will bottleneck
|
|
||||||
c = 4;
|
|
||||||
|
|
||||||
c += 2;
|
|
||||||
|
|
||||||
m_journal.info << "Auto-tuning to " << c <<
|
m_journal.info << "Auto-tuning to " << c <<
|
||||||
" validation/transaction/proposal threads";
|
" validation/transaction/proposal threads";
|
||||||
|
|||||||
Reference in New Issue
Block a user