xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
xrpld
app
main
BasicApp.h
1
#pragma once
2
3
#include <boost/asio/io_context.hpp>
4
5
#include <
cstddef
>
6
#include <
optional
>
7
#include <
thread
>
8
#include <
vector
>
9
10
// This is so that the io_context can outlive all the children
11
class
BasicApp
12
{
13
private
:
14
std::optional<boost::asio::executor_work_guard<boost::asio::io_context::executor_type>
>
work_
;
15
std::vector<std::thread>
threads_
;
16
boost::asio::io_context
ioContext_
;
17
18
public
:
19
BasicApp
(
std::size_t
numberOfThreads);
20
~BasicApp
();
21
22
boost::asio::io_context&
23
getIoContext
()
24
{
25
return
ioContext_
;
26
}
27
28
[[nodiscard]]
size_t
29
getNumberOfThreads
()
const
30
{
31
return
threads_
.size();
32
}
33
};
BasicApp::getNumberOfThreads
size_t getNumberOfThreads() const
Definition
BasicApp.h:29
BasicApp::threads_
std::vector< std::thread > threads_
Definition
BasicApp.h:15
BasicApp::~BasicApp
~BasicApp()
Definition
BasicApp.cpp:24
BasicApp::BasicApp
BasicApp(std::size_t numberOfThreads)
Definition
BasicApp.cpp:10
BasicApp::work_
std::optional< boost::asio::executor_work_guard< boost::asio::io_context::executor_type > > work_
Definition
BasicApp.h:14
BasicApp::ioContext_
boost::asio::io_context ioContext_
Definition
BasicApp.h:16
BasicApp::getIoContext
boost::asio::io_context & getIoContext()
Definition
BasicApp.h:23
cstddef
optional
std::size_t
thread
vector
Generated by
1.17.0