Kea 3.1.3
isc::asiolink::IOServiceImpl Class Reference

Public Member Functions

 IOServiceImpl ()
 The constructor.
 
 ~IOServiceImpl ()=default
 The destructor.
 
boost::asio::io_context & getInternalIOService ()
 Return the native io_context object used in this wrapper.
 
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 post (const std::function< void()> &callback)
 Post a callback on the IO service.
 
void restart ()
 Restarts the IOService in preparation for a subsequent run() invocation.
 
void run ()
 Start the underlying event loop.
 
size_t runOne ()
 Run the underlying event loop for a single event.
 
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.
 
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.
 

Detailed Description

Definition at line 24 of file io_service.cc.

Constructor & Destructor Documentation

◆ IOServiceImpl()

isc::asiolink::IOServiceImpl::IOServiceImpl ( )
inline

The constructor.

Definition at line 35 of file io_service.cc.

◆ ~IOServiceImpl()

isc::asiolink::IOServiceImpl::~IOServiceImpl ( )
default

The destructor.

Member Function Documentation

◆ getInternalIOService()

boost::asio::io_context & isc::asiolink::IOServiceImpl::getInternalIOService ( )
inline

Return the native io_context object used in this wrapper.

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

Definition at line 134 of file io_service.cc.

◆ poll()

size_t isc::asiolink::IOServiceImpl::poll ( )
inline

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.

Returns
The number of handlers that were executed.

Definition at line 89 of file io_service.cc.

◆ pollOne()

size_t isc::asiolink::IOServiceImpl::pollOne ( )
inline

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.

Returns
The number of handlers that were executed.

Definition at line 99 of file io_service.cc.

◆ post()

void isc::asiolink::IOServiceImpl::post ( const std::function< void()> & callback)
inline

Post a callback on the IO service.

Parameters
callbackThe callback to be run on the IO service.

Definition at line 141 of file io_service.cc.

◆ restart()

void isc::asiolink::IOServiceImpl::restart ( )
inline

Restarts the IOService in preparation for a subsequent run() invocation.

Definition at line 118 of file io_service.cc.

◆ run()

void isc::asiolink::IOServiceImpl::run ( )
inline

Start the underlying event loop.

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

Definition at line 48 of file io_service.cc.

◆ runOne()

size_t isc::asiolink::IOServiceImpl::runOne ( )
inline

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.)

Returns
The number of handlers that were executed.

Definition at line 59 of file io_service.cc.

◆ runOneFor()

size_t isc::asiolink::IOServiceImpl::runOneFor ( size_t wait_time_usecs,
bool & timed_out )
inline

Run the underlying event loop for a single event or until a wait time expires.

This method returns control to the caller as soon as the first handler has completed or the wait time elapses. If the number of handlers executed is zero and timed_out is set to false this indicates that the IOService was stopped.

Parameters
wait_time_usecswait time in microseconds.
[out]timed_outset to true if the wait time expired without any handlers executing. timed_out parameter will be set true if the wait time elapsed.
Returns
The number of handlers that were executed.

Definition at line 77 of file io_service.cc.

◆ stop()

void isc::asiolink::IOServiceImpl::stop ( )
inline

Stop the underlying event loop.

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

Definition at line 106 of file io_service.cc.

◆ stopped()

bool isc::asiolink::IOServiceImpl::stopped ( ) const
inline

Indicates if the IOService has been stopped.

Returns
true if the IOService has been stopped, false otherwise.

Definition at line 113 of file io_service.cc.

◆ stopWork()

void isc::asiolink::IOServiceImpl::stopWork ( )
inline

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

Definition at line 124 of file io_service.cc.


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