boost::corosio::native_io_context

An I/O context with devirtualized event loop methods.

Synopsis

template<auto Backend>
class native_io_context
    : public io_context

Description

This class template inherits from io_context and shadows all public methods with versions that call the concrete scheduler directly, bypassing virtual dispatch. No new state is added.

A native_io_context IS‐A io_context and can be passed anywhere an io_context& is accepted, in which case virtual dispatch is used transparently.

Thread Safety

Same as the underlying context type.

Example

#include <boost/corosio/native/native_io_context.hpp>

native_io_context<epoll> ctx;
ctx.poll();  // devirtualized call

Base Classes

Name

Description

io_context

An I/O context for running asynchronous operations.

Types

Name

Description

executor_type

The executor type for this context.

service

Abstract base class for services owned by an execution context.

Member Functions

Name

Description

native_io_context [constructor]

Constructors

operator= [deleted]

Assignment operators

find_service

Return a pointer to the service of type T, or nullptr.

get_executor

Return an executor for this context.

get_frame_allocator

Return the memory resource used for coroutine frame allocation.

has_service

Return true if a service of type T exists.

make_service

Construct and add a service.

poll

Process all ready work items without blocking.

poll_one

Process at most one ready work item without blocking.

restart

Restart the context after being stopped.

run

Process all pending work items.

run_for

Process work items for the specified duration.

run_one

Process at most one pending work item.

run_one_for

Process at most one work item for the specified duration.

run_one_until

Process at most one work item until the specified time.

run_until

Process work items until the specified time.

set_frame_allocator

set_frame_allocator overloads

stop

Signal the context to stop processing.

stopped

Return whether the context has been stopped.

target

Return a pointer to this context if it matches the requested type.

use_service

Return a reference to the service of type T, creating it if needed.

Protected Member Functions

Name

Description

destroy

Destroy all services.

shutdown

Shut down all services.

Protected Data Members

Name

sched_

Template Parameters

Name

Description

Backend

A backend tag value (e.g., epoll, iocp) whose type provides scheduler_type.

See Also

io_context, epoll_t, iocp_t

Created with MrDocs