Kea 3.1.5
io_service.h
Go to the documentation of this file.
1// Copyright (C) 2011-2025 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef ASIOLINK_IO_SERVICE_H
8#define ASIOLINK_IO_SERVICE_H
9
10#include <boost/version.hpp>
11#include <boost/shared_ptr.hpp>
12#include <functional>
13#include <list>
14
15#if BOOST_VERSION < 106600
16#error "Boost ASIO older than 1.66 are not supported"
17#endif
18
19#ifdef __GNUC__
20#pragma GCC diagnostic push
21#pragma GCC diagnostic ignored "-Woverloaded-virtual"
22#endif
23#include <boost/asio/io_context.hpp>
24#ifdef __GNUC__
25#pragma GCC diagnostic pop
26#endif
27
28namespace isc {
29namespace asiolink {
30
31class IOServiceImpl;
32class IOService;
33
35typedef boost::shared_ptr<IOService> IOServicePtr;
36
39class IOService {
44
45private:
46 IOService(const IOService& source);
47 IOService& operator=(const IOService& source);
48public:
50 IOService();
51
53 ~IOService();
55
60 void run();
61
69 size_t runOne();
70
85 size_t runOneFor(size_t wait_time_usecs, bool& timed_out);
86
93 size_t poll();
94
101 size_t pollOne();
102
106 void stop();
107
111 bool stopped() const;
112
114 void restart();
115
118 void stopWork();
119
128 boost::asio::io_context& getInternalIOService();
129
139 void post(const std::function<void ()>& callback);
140
144 void stopAndPoll(bool ignore_errors = true);
145
146private:
147
149 boost::shared_ptr<IOServiceImpl> io_impl_;
150};
151
152} // namespace asiolink
153} // namespace isc
154
155#endif // ASIOLINK_IO_SERVICE_H
Defines the logger used by the top-level component of kea-lfc.