mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
31 lines
651 B
C++
31 lines
651 B
C++
#include <xrpld/app/main/BasicApp.h>
|
|
|
|
#include <xrpl/beast/core/CurrentThreadName.h>
|
|
|
|
#include <boost/asio/executor_work_guard.hpp>
|
|
|
|
#include <cstddef>
|
|
#include <string>
|
|
|
|
BasicApp::BasicApp(std::size_t numberOfThreads)
|
|
{
|
|
work_.emplace(boost::asio::make_work_guard(io_context_));
|
|
threads_.reserve(numberOfThreads);
|
|
|
|
for (std::size_t i = 0; i < numberOfThreads; ++i)
|
|
{
|
|
threads_.emplace_back([this, i]() {
|
|
beast::setCurrentThreadName("io svc #" + std::to_string(i));
|
|
this->io_context_.run();
|
|
});
|
|
}
|
|
}
|
|
|
|
BasicApp::~BasicApp()
|
|
{
|
|
work_.reset();
|
|
|
|
for (auto& t : threads_)
|
|
t.join();
|
|
}
|