Kea  1.5.0
isc::asiolink::IOService Class Reference

The IOService class is a wrapper for the ASIO io_service class. More...

#include <io_service.h>

Public Member Functions

boost::asio::io_service & get_io_service ()
 Return the native io_service object used in this wrapper. More...
 
void poll ()
 Run the underlying event loop for a ready events. More...
 
void post (const boost::function< void()> &callback)
 Post a callback to the end of the queue. More...
 
void run ()
 Start the underlying event loop. More...
 
void run_one ()
 Run the underlying event loop for a single event. More...
 
void stop ()
 Stop the underlying event loop. More...
 
void stopWork ()
 Removes IO service work object to let it finish running when all handlers have been invoked. More...
 

Constructors and Destructor

Note: The copy constructor and the assignment operator are intentionally defined as private, making this class non-copyable.

 IOService ()
 The constructor. More...
 
 ~IOService ()
 The destructor. More...
 

Detailed Description

The IOService class is a wrapper for the ASIO io_service class.

Definition at line 31 of file io_service.h.

Constructor & Destructor Documentation

◆ IOService()

isc::asiolink::IOService::IOService ( )

The constructor.

Definition at line 102 of file io_service.cc.

◆ ~IOService()

isc::asiolink::IOService::~IOService ( )

The destructor.

Definition at line 106 of file io_service.cc.

Member Function Documentation

◆ get_io_service()

boost::asio::io_service & isc::asiolink::IOService::get_io_service ( )

Return the native io_service object used in this wrapper.

This is a short term work around to support other Kea modules that share the same io_service with the authoritative server. It will eventually be removed once the wrapper interface is generalized.

Definition at line 136 of file io_service.cc.

References isc::asiolink::IOServiceImpl::get_io_service().

Referenced by isc::dhcp_ddns::NameChangeUDPListener::open(), isc::dhcp_ddns::NameChangeUDPSender::open(), and isc::dhcp_ddns::NameChangeSender::runReadyIO().

+ Here is the call graph for this function:

◆ poll()

void isc::asiolink::IOService::poll ( )

Run the underlying event loop for a ready events.

This method executes handlers for all ready events and returns. It will return immediately if there are no ready events.

Definition at line 121 of file io_service.cc.

References isc::asiolink::IOServiceImpl::poll().

+ Here is the call graph for this function:

◆ post()

void isc::asiolink::IOService::post ( const boost::function< void()> &  callback)

Post a callback to the end of the queue.

Requests the callback be called sometime later. It is not guaranteed by the underlying asio, but it can reasonably be expected the callback is put to the end of the callback queue. It is not called from within this function.

It may be used to implement "background" work, for example (doing stuff by small bits that are called from time to time).

Definition at line 141 of file io_service.cc.

References isc::asiolink::IOServiceImpl::post().

Referenced by isc::d2::DNSClientImpl::doUpdate().

+ Here is the call graph for this function:

◆ run()

void isc::asiolink::IOService::run ( )

Start the underlying event loop.

This method does not return control to the caller until the stop() method is called via some handler.

Definition at line 111 of file io_service.cc.

References isc::asiolink::IOServiceImpl::run().

Referenced by isc::ha::HAService::synchronize().

+ Here is the call graph for this function:

◆ run_one()

void isc::asiolink::IOService::run_one ( )

Run the underlying event loop for a single event.

This method return control to the caller as soon as the first handler has completed. (If no handlers are ready when it is run, it will block until one is.)

Definition at line 116 of file io_service.cc.

References isc::asiolink::IOServiceImpl::run_one().

+ Here is the call graph for this function:

◆ stop()

void isc::asiolink::IOService::stop ( )

Stop the underlying event loop.

This will return the control to the caller of the run() method.

Definition at line 126 of file io_service.cc.

References isc::asiolink::IOServiceImpl::stop().

Referenced by isc::dhcp::ControlledDhcpv4Srv::shutdown(), isc::dhcp::ControlledDhcpv6Srv::shutdown(), and isc::ha::HAService::synchronize().

+ Here is the call graph for this function:

◆ stopWork()

void isc::asiolink::IOService::stopWork ( )

Removes IO service work object to let it finish running when all handlers have been invoked.

Definition at line 131 of file io_service.cc.

References isc::asiolink::IOServiceImpl::stopWork().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: