Kea 2.7.0
io_service.h
Go to the documentation of this file.
1// Copyright (C) 2011-2024 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
15namespace boost {
16namespace asio {
17#if BOOST_VERSION < 106600
18 class io_service;
19#else
20 class io_context;
21 typedef io_context io_service;
22#endif
23}
24}
25
26namespace isc {
27namespace asiolink {
28
29class IOServiceImpl;
30class IOService;
31
33typedef boost::shared_ptr<IOService> IOServicePtr;
34
37class IOService {
42
43private:
44 IOService(const IOService& source);
45 IOService& operator=(const IOService& source);
46public:
48 IOService();
49
51 ~IOService();
53
58 void run();
59
67 size_t runOne();
68
75 size_t poll();
76
83 size_t pollOne();
84
88 void stop();
89
93 bool stopped() const;
94
96 void restart();
97
100 void stopWork();
101
110 boost::asio::io_service& getInternalIOService();
111
121 void post(const std::function<void ()>& callback);
122
126 void stopAndPoll(bool ignore_errors = true);
127
128private:
129
131 boost::shared_ptr<IOServiceImpl> io_impl_;
132};
133
134} // namespace asiolink
135} // namespace isc
136
137#endif // ASIOLINK_IO_SERVICE_H
Defines the logger used by the top-level component of kea-lfc.