rippled
Loading...
Searching...
No Matches
BasicApp.cpp
1#include <xrpld/app/main/BasicApp.h>
2
3#include <xrpl/beast/core/CurrentThreadName.h>
4
5#include <boost/asio/executor_work_guard.hpp>
6
8{
9 work_.emplace(boost::asio::make_work_guard(io_context_));
10 threads_.reserve(numberOfThreads);
11
12 while (numberOfThreads--)
13 {
14 threads_.emplace_back([this, numberOfThreads]() {
16 "io svc #" + std::to_string(numberOfThreads));
17 this->io_context_.run();
18 });
19 }
20}
21
23{
24 work_.reset();
25
26 for (auto& t : threads_)
27 t.join();
28}
boost::asio::io_context io_context_
Definition BasicApp.h:18
std::vector< std::thread > threads_
Definition BasicApp.h:17
BasicApp(std::size_t numberOfThreads)
Definition BasicApp.cpp:7
std::optional< boost::asio::executor_work_guard< boost::asio::io_context::executor_type > > work_
Definition BasicApp.h:16
T emplace_back(T... args)
T emplace(T... args)
void setCurrentThreadName(std::string_view newThreadName)
Changes the name of the caller thread.
T reserve(T... args)
T reset(T... args)
T to_string(T... args)