RESTinio
Loading...
Searching...
No Matches
null_timer_manager.hpp
Go to the documentation of this file.
1/*
2 restinio
3*/
4
5/*!
6 No-op timer factory implementation.
7*/
8
9#pragma once
10
11#include <chrono>
12
13#include <restinio/asio_include.hpp>
14
15#include <restinio/timer_common.hpp>
16
17namespace restinio
18{
19
20//
21// null_timer_manager_t
22//
23
24//! Timer factory implementation using asio timers.
25struct null_timer_manager_t final
26{
27 //! Timer guard for async operations.
29 {
30 // Schedule timeouts check invocation.
31 template <typename... Args >
32 constexpr void schedule( Args &&... ) const noexcept {}
33
34 // Cancel timeout guard if any.
35 constexpr void cancel() const noexcept {}
36 };
37
38 // Create guard for connection.
39 constexpr timer_guard_t
40 create_timer_guard() const noexcept { return timer_guard_t{}; }
41
42 //! Start/stop timer manager.
43 //! \{
44 constexpr void start() const noexcept {}
45 constexpr void stop() const noexcept {}
46 //! \}
47
48 struct factory_t final
49 {
50 auto
51 create( asio_ns::io_context & ) const
52 {
53 return std::make_shared< null_timer_manager_t >();
54 }
55 };
56};
57
58} /* namespace restinio */
auto create(asio_ns::io_context &) const
constexpr void schedule(Args &&...) const noexcept
constexpr void stop() const noexcept
constexpr void start() const noexcept
Start/stop timer manager.
constexpr timer_guard_t create_timer_guard() const noexcept