Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
Timer.hpp
1
#pragma once
2
3
#include <boost/asio/steady_timer.hpp>
4
5
namespace
util::async::impl {
6
7
template
<
typename
ExecutorType>
8
class
SteadyTimer {
9
boost::asio::steady_timer timer_;
10
11
public
:
12
SteadyTimer(ExecutorType& executor,
auto
delay,
auto
&& fn) : timer_{executor}
13
{
14
timer_.expires_after(delay);
15
timer_.async_wait(std::forward<
decltype
(fn)>(fn));
16
}
17
18
SteadyTimer(SteadyTimer&&) =
default
;
19
20
SteadyTimer(SteadyTimer
const
&) =
delete
;
21
22
void
23
cancel()
noexcept
24
{
25
timer_.cancel();
26
}
27
};
28
29
}
// namespace util::async::impl
src
util
async
context
impl
Timer.hpp
Generated by
1.17.0