mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Improve automatic I/O thread tuning algorithm
This commit is contained in:
@@ -24,20 +24,22 @@ BasicApp::BasicApp(std::size_t numberOfThreads)
|
||||
{
|
||||
work_.emplace (io_service_);
|
||||
threads_.reserve(numberOfThreads);
|
||||
|
||||
while(numberOfThreads--)
|
||||
threads_.emplace_back(
|
||||
[this, numberOfThreads]()
|
||||
{
|
||||
threads_.emplace_back([this, numberOfThreads]()
|
||||
{
|
||||
beast::setCurrentThreadName(
|
||||
std::string("io_service #") +
|
||||
std::to_string(numberOfThreads));
|
||||
this->io_service_.run();
|
||||
beast::setCurrentThreadName("io svc #" +
|
||||
std::to_string(numberOfThreads));
|
||||
this->io_service_.run();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
BasicApp::~BasicApp()
|
||||
{
|
||||
work_ = boost::none;
|
||||
for (auto& _ : threads_)
|
||||
_.join();
|
||||
|
||||
for (auto& t : threads_)
|
||||
t.join();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user