Files
rippled/src/xrpld/app/main/BasicApp.cpp
Pratik Mankawde 3547112540 fix: Fix ubsan flagged issues (#6151)
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>
2026-04-27 20:34:16 +00:00

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();
}