Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
SyncExecutionContext.hpp
1
#pragma once
2
3
#include "util/async/context/BasicExecutionContext.hpp"
4
#include "util/async/context/SystemExecutionContext.hpp"
5
#include "util/async/context/impl/Cancellation.hpp"
6
7
#include <boost/asio/error.hpp>
8
9
#include <cstddef>
10
11
namespace
util::async
{
12
namespace
impl {
13
14
struct
SameThreadContext
{
15
struct
Executor {
16
Executor(std::size_t)
17
{
18
}
19
20
void
21
stop()
const
noexcept
22
{
23
}
24
25
void
26
join()
const
noexcept
27
{
28
}
29
};
30
31
// Note: these types are not actually used but needed for compilation
32
struct
Timer
{};
33
struct
Strand
{
34
struct
Executor
{};
35
struct
Timer
{};
36
};
37
38
Executor
executor;
39
40
void
41
stop() const noexcept
42
{
43
executor.stop();
44
}
45
46
void
47
join() const noexcept
48
{
49
executor.join();
50
}
51
52
Executor&
53
getExecutor()
54
{
55
return
executor;
56
}
57
58
[[nodiscard]] Strand
59
makeStrand() noexcept
// NOLINT(readability-convert-member-functions-to-static)
60
{
61
return
{};
62
}
63
};
64
65
struct
SystemContextProvider
{
66
template
<
typename
CtxType>
67
[[nodiscard]]
static
constexpr
auto
&
68
getContext([[maybe_unused]] CtxType& self)
noexcept
69
{
70
return
SystemExecutionContext::instance
();
71
}
72
};
73
74
}
// namespace impl
75
85
using
SyncExecutionContext
=
BasicExecutionContext
<
86
impl::SameThreadContext
,
87
impl::BasicStopSource
,
88
impl::SyncDispatchStrategy
,
89
impl::SystemContextProvider
>;
90
91
}
// namespace util::async
util::async::BasicExecutionContext
A highly configurable execution context.
Definition
BasicExecutionContext.hpp:114
util::async::SystemExecutionContext::instance
static auto & instance()
Get the instance of the system execution context.
Definition
SystemExecutionContext.hpp:21
util::async::impl::BasicStopSource
Definition
Cancellation.hpp:86
util::async
This namespace implements an async framework built on top of execution contexts.
Definition
AnyExecutionContext.hpp:18
util::async::SyncExecutionContext
BasicExecutionContext< impl::SameThreadContext, impl::BasicStopSource, impl::SyncDispatchStrategy, impl::SystemContextProvider > SyncExecutionContext
A synchronous execution context. Runs on the caller thread.
Definition
SyncExecutionContext.hpp:85
util::async::impl::SameThreadContext::Executor
Definition
SyncExecutionContext.hpp:15
util::async::impl::SameThreadContext::Strand::Executor
Definition
SyncExecutionContext.hpp:34
util::async::impl::SameThreadContext::Strand::Timer
Definition
SyncExecutionContext.hpp:35
util::async::impl::SameThreadContext::Strand
Definition
SyncExecutionContext.hpp:33
util::async::impl::SameThreadContext::Timer
Definition
SyncExecutionContext.hpp:32
util::async::impl::SameThreadContext
Definition
SyncExecutionContext.hpp:14
util::async::impl::SyncDispatchStrategy
Definition
Execution.hpp:90
util::async::impl::SystemContextProvider
Definition
SyncExecutionContext.hpp:65
src
util
async
context
SyncExecutionContext.hpp
Generated by
1.17.0