rippled
Loading...
Searching...
No Matches
xrpld
app
main
BasicApp.h
1
//------------------------------------------------------------------------------
2
/*
3
This file is part of rippled: https://github.com/ripple/rippled
4
Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6
Permission to use, copy, modify, and/or distribute this software for any
7
purpose with or without fee is hereby granted, provided that the above
8
copyright notice and this permission notice appear in all copies.
9
10
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
*/
18
//==============================================================================
19
20
#ifndef RIPPLE_APP_BASICAPP_H_INCLUDED
21
#define RIPPLE_APP_BASICAPP_H_INCLUDED
22
23
#include <boost/asio/io_context.hpp>
24
25
#include <
optional
>
26
#include <
thread
>
27
#include <
vector
>
28
29
// This is so that the io_context can outlive all the children
30
class
BasicApp
31
{
32
private
:
33
std::optional
<boost::asio::executor_work_guard<
34
boost::asio::io_context::executor_type>>
35
work_
;
36
std::vector<std::thread>
threads_
;
37
boost::asio::io_context
io_context_
;
38
39
public
:
40
BasicApp
(
std::size_t
numberOfThreads);
41
~BasicApp
();
42
43
boost::asio::io_context&
44
get_io_context
()
45
{
46
return
io_context_
;
47
}
48
};
49
50
#endif
BasicApp
Definition
BasicApp.h:31
BasicApp::io_context_
boost::asio::io_context io_context_
Definition
BasicApp.h:37
BasicApp::threads_
std::vector< std::thread > threads_
Definition
BasicApp.h:36
BasicApp::~BasicApp
~BasicApp()
Definition
BasicApp.cpp:41
BasicApp::get_io_context
boost::asio::io_context & get_io_context()
Definition
BasicApp.h:44
BasicApp::work_
std::optional< boost::asio::executor_work_guard< boost::asio::io_context::executor_type > > work_
Definition
BasicApp.h:35
optional
std::size_t
thread
vector
Generated by
1.9.8