13#include <netinet/in.h>
14#include <boost/shared_ptr.hpp>
15#include <sys/socket.h>
33 work_(new
boost::asio::io_service::work(io_service_)) {
56 return (
static_cast<size_t>(io_service_.run_one()));
66 return (
static_cast<size_t>(io_service_.poll()));
76 return (
static_cast<size_t>(io_service_.poll_one()));
90 return (io_service_.stopped());
111 return (io_service_);
117 void post(
const std::function<
void ()>& callback) {
118 io_service_.post(callback);
122 boost::asio::io_service io_service_;
123 boost::shared_ptr<boost::asio::io_service::work> work_;
139 return (io_impl_->runOne());
144 return (io_impl_->poll());
149 return (io_impl_->pollOne());
159 return (io_impl_->stopped());
169 io_impl_->stopWork();
172boost::asio::io_service&
174 return (io_impl_->getInternalIOService());
179 return (io_impl_->post(callback));
IOServiceImpl()
The constructor.
boost::asio::io_service & getInternalIOService()
Return the native io_service object used in this wrapper.
~IOServiceImpl()=default
The destructor.
void run()
Start the underlying event loop.
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.
size_t pollOne()
Run the underlying event loop for a ready events.
void stop()
Stop the underlying event loop.
void restart()
Restarts the IOService in preparation for a subsequent run() invocation.
size_t runOne()
Run the underlying event loop for a single event.
void post(const std::function< void()> &callback)
Post a callback on the IO service.
bool stopped() const
Indicates if the IOService has been stopped.
The IOService class is a wrapper for the ASIO io_service 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_service & getInternalIOService()
Return the native io_service 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.
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.
A wrapper interface for the ASIO library.
Defines the logger used by the top-level component of kea-lfc.