mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-23 15:20:54 +00:00
33 lines
637 B
C++
33 lines
637 B
C++
#pragma once
|
|
|
|
#include <boost/asio/io_context.hpp>
|
|
|
|
#include <optional>
|
|
#include <thread>
|
|
#include <vector>
|
|
|
|
// This is so that the io_context can outlive all the children
|
|
class BasicApp
|
|
{
|
|
private:
|
|
std::optional<boost::asio::executor_work_guard<boost::asio::io_context::executor_type>> work_;
|
|
std::vector<std::thread> threads_;
|
|
boost::asio::io_context ioContext_;
|
|
|
|
public:
|
|
BasicApp(std::size_t numberOfThreads);
|
|
~BasicApp();
|
|
|
|
boost::asio::io_context&
|
|
getIoContext()
|
|
{
|
|
return ioContext_;
|
|
}
|
|
|
|
[[nodiscard]] size_t
|
|
getNumberOfThreads() const
|
|
{
|
|
return threads_.size();
|
|
}
|
|
};
|