Kea 2.5.8
io_service.h
Go to the documentation of this file.
1// Copyright (C) 2011-2021 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
14namespace boost {
15namespace asio {
16#if BOOST_VERSION < 106600
17 class io_service;
18#else
19 class io_context;
20 typedef io_context io_service;
21#endif
22}
23}
24
25namespace isc {
26namespace asiolink {
27
28class IOServiceImpl;
29
33class IOService {
39
40private:
41 IOService(const IOService& source);
42 IOService& operator=(const IOService& source);
43public:
45 IOService();
47 ~IOService();
49
54 void run();
55
63 size_t runOne();
64
71 size_t poll();
72
79 size_t pollOne();
80
84 void stop();
85
89 bool stopped() const;
90
92 void restart();
93
96 void stopWork();
97
104 boost::asio::io_service& getInternalIOService();
105
115 void post(const std::function<void ()>& callback);
116
117private:
118 boost::shared_ptr<IOServiceImpl> io_impl_;
119};
120
122typedef boost::shared_ptr<IOService> IOServicePtr;
123
124} // namespace asiolink
125} // namespace isc
126#endif // ASIOLINK_IO_SERVICE_H
Defines the logger used by the top-level component of kea-lfc.