Files
rippled/src/xrpld/app/main/BasicApp.cpp
Pratik Mankawde 9dd2ca1e4a fix: Address code review findings for TSAN/ASAN PR
- Fix BasicApp::startIOThreads() member corruption: replace
  while(numberOfThreads_--) with a for loop to preserve the member value.
- Fix Coro.ipp non-sanitizer stack size: increase default from 1MB to 2MB
  to match yield_to.h and prevent stack overflows in deep call chains.
- Remove stale "TSAN deactivated" comment and dead activate_tsan variable
  from CI matrix generator.
- Clarify Application.cpp setup() comment to distinguish io_context threads
  from subsystem-specific threads.
- Use explicit load(std::memory_order_relaxed) at all SHAMap::ledgerSeq_
  read sites for consistency with the atomic store.
- Extract sanitizer detection into XRPL_SANITIZER_ACTIVE macro in
  sanitizers.h, replacing duplicated preprocessor blocks in Coro.ipp
  and yield_to.h.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 12:51:51 +00:00

39 lines
877 B
C++

#include <xrpld/app/main/BasicApp.h>
#include <xrpl/beast/core/CurrentThreadName.h>
#include <boost/asio/executor_work_guard.hpp>
BasicApp::BasicApp(std::size_t numberOfThreads) : numberOfThreads_(numberOfThreads)
{
work_.emplace(boost::asio::make_work_guard(io_context_));
startIOThreads();
}
BasicApp::BasicApp(std::size_t numberOfThreads, DeferStart) : numberOfThreads_(numberOfThreads)
{
work_.emplace(boost::asio::make_work_guard(io_context_));
}
void
BasicApp::startIOThreads()
{
threads_.reserve(numberOfThreads_);
for (std::size_t i = 0; i < numberOfThreads_; ++i)
{
threads_.emplace_back([this, n = i]() {
beast::setCurrentThreadName("io svc #" + std::to_string(n));
this->io_context_.run();
});
}
}
BasicApp::~BasicApp()
{
work_.reset();
for (auto& t : threads_)
t.join();
}