13#include <netinet/in.h>
14#include <boost/shared_ptr.hpp>
15#include <sys/socket.h>
28 work_(new
boost::asio::io_service::work(io_service_)) {
52 return (
static_cast<size_t>(io_service_.run_one()));
62 return (
static_cast<size_t>(io_service_.poll()));
72 return (
static_cast<size_t>(io_service_.poll_one()));
86 return (io_service_.stopped());
107 return (io_service_);
113 void post(
const std::function<
void ()>& callback) {
114 io_service_.post(callback);
118 boost::asio::io_service io_service_;
119 boost::shared_ptr<boost::asio::io_service::work> work_;
135 return (io_impl_->runOne());
140 return (io_impl_->poll());
145 return (io_impl_->pollOne());
155 return (io_impl_->stopped());
165 io_impl_->stopWork();
168boost::asio::io_service&
170 return (io_impl_->getInternalIOService());
175 return (io_impl_->post(callback));
IOServiceImpl()
The constructor.
boost::asio::io_service & getInternalIOService()
Return the native io_service object used in this wrapper.
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.
~IOServiceImpl()
The destructor.
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 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.