Kea 2.7.7
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#include <boost/asio/io_context.hpp>
20
21namespace isc {
22namespace asiolink {
23
24class IOServiceImpl;
25class IOService;
26
28typedef boost::shared_ptr<IOService> IOServicePtr;
29
32class IOService {
37
38private:
39 IOService(const IOService& source);
40 IOService& operator=(const IOService& source);
41public:
43 IOService();
44
46 ~IOService();
48
53 void run();
54
62 size_t runOne();
63
70 size_t poll();
71
78 size_t pollOne();
79
83 void stop();
84
88 bool stopped() const;
89
91 void restart();
92
95 void stopWork();
96
105 boost::asio::io_context& getInternalIOService();
106
116 void post(const std::function<void ()>& callback);
117
121 void stopAndPoll(bool ignore_errors = true);
122
123private:
124
126 boost::shared_ptr<IOServiceImpl> io_impl_;
127};
128
129} // namespace asiolink
130} // namespace isc
131
132#endif // ASIOLINK_IO_SERVICE_H
Defines the logger used by the top-level component of kea-lfc.