12 #include <netinet/in.h>
13 #include <boost/shared_ptr.hpp>
14 #include <sys/socket.h>
23 class CallbackWrapper {
27 CallbackWrapper(
const std::function<
void()>& callback) :
50 work_(new
boost::asio::io_service::work(io_service_)) {
71 io_service_.run_one();
93 return (io_service_.stopped());
114 return (io_service_);
120 void post(
const std::function<
void ()>& callback) {
121 const CallbackWrapper wrapper(callback);
122 io_service_.post(wrapper);
126 boost::asio::io_service io_service_;
127 boost::shared_ptr<boost::asio::io_service::work> work_;
158 return (io_impl_->stopped());
168 io_impl_->stopWork();
171 boost::asio::io_service&
173 return (io_impl_->get_io_service());
178 return (io_impl_->post(callback));
void poll()
Run the underlying event loop for a ready events.
void run()
Start the underlying event loop.
void run()
Start the underlying event loop.
std::function< void()> callback_
The callback function.
void post(const std::function< void()> &callback)
Post a callback to the end of the queue.
IOServiceImpl()
The constructor.
boost::asio::io_service & get_io_service()
Return the native io_service object used in this wrapper.
void stopWork()
Removes IO service work object to let it finish running when all handlers have been invoked...
The IOService class is a wrapper for the ASIO io_service class.
void run_one()
Run the underlying event loop for a single event.
void post(const std::function< void()> &callback)
Post a callback on the IO service.
void stop()
Stop the underlying event loop.
void restart()
Restarts the IOService in preparation for a subsequent run() invocation.
void stop()
Stop the underlying event loop.
boost::asio::io_service & get_io_service()
Return the native io_service object used in this wrapper.
bool stopped() const
Indicates if the IOService has been stopped.
void run_one()
Run the underlying event loop for a single event.
Defines the logger used by the top-level component of kea-dhcp-ddns.
void restart()
Restarts the IOService in preparation for a subsequent run() invocation.
IOService()
The constructor.
~IOServiceImpl()
The destructor.
A wrapper interface for the ASIO library.
~IOService()
The destructor.
void poll()
Run the underlying event loop for a ready events.
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...