7#ifndef ASIOLINK_IO_SERVICE_H
8#define ASIOLINK_IO_SERVICE_H
10#include <boost/version.hpp>
11#include <boost/shared_ptr.hpp>
15#if BOOST_VERSION < 106600
16#error "Boost ASIO older than 1.66 are not supported"
19#include <boost/asio/io_context.hpp>
40 IOService& operator=(
const IOService& source);
78 size_t runOneFor(
size_t wait_time_usecs,
bool& timed_out);
132 void post(
const std::function<
void ()>& callback);
142 boost::shared_ptr<IOServiceImpl> io_impl_;
The IOService class is a wrapper for the ASIO io_context class.
~IOService()
The destructor.
void run()
Start the underlying event loop.
size_t pollOne()
Run the underlying event loop for a ready events.
IOService()
The constructor.
boost::asio::io_context & getInternalIOService()
Return the native io_context object used in this wrapper.
size_t runOne()
Run the underlying event loop for a single event.
void stopAndPoll(bool ignore_errors=true)
Stop and poll to handle all registered events.
size_t runOneFor(size_t wait_time_usecs, bool &timed_out)
Run the underlying event loop for a single event or until a wait time expires.
void stop()
Stop the underlying event loop.
void restart()
Restarts the IOService in preparation for a subsequent run() invocation.
bool stopped() const
Indicates if the IOService has been stopped.
void stopWork()
Removes IO service work object to let it finish running when all handlers have been invoked.
size_t poll()
Run the underlying event loop for a ready events.
void post(const std::function< void()> &callback)
Post a callback to the end of the queue.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
Defines the logger used by the top-level component of kea-lfc.