AsyncBerkeley
Asynchronous Berkeley sockets. Simple.
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
io::execution::basic_poll_multiplexer< Allocator > Class Template Reference

A multiplexer that uses the poll system call. More...

#include <io/execution/poll_multiplexer.hpp>

Inheritance diagram for io::execution::basic_poll_multiplexer< Allocator >:
io::execution::basic_multiplexer< poll_t >

Classes

struct  demultiplexer
 Demultiplexes I/O operations for a socket. More...
 
struct  sender
 A sender for the poll multiplexer. More...
 

Public Types

using Base = basic_multiplexer< poll_t >
 The base class for the multiplexer.
 
using socket_handle = ::io::socket::socket_handle
 The socket handle type.
 
using task = Base::intrusive_task_queue::task
 The task type.
 
using native_socket_type = ::io::socket::native_socket_type
 The native socket type.
 
using vector_allocator = std::allocator_traits< Allocator >::template rebind_alloc< event_type >
 The allocator for the vector.
 
using vector_type = std::vector< event_type, vector_allocator >
 The vector type.
 
using map_allocator = std::allocator_traits< Allocator >::template rebind_alloc< demultiplexer >
 The allocator for the map.
 
using map_type = std::deque< demultiplexer, map_allocator >
 The map type.
 
- Public Types inherited from io::execution::basic_multiplexer< poll_t >
using multiplexer_type = Tag
 The tag type for the multiplexer.
 

Public Member Functions

auto wait_for (interval_type interval) -> size_type
 Waits for events to occur.
 
template<Completion Fn>
auto set (std::shared_ptr< socket_handle > socket, execution_trigger trigger, Fn &&func) -> sender< std::decay_t< Fn > >
 Sets a completion handler for an event.
 
constexpr basic_poll_multiplexer (const Allocator &alloc=Allocator()) noexcept(noexcept(Allocator()))
 Default constructor.
 

Detailed Description

template<AllocatorLike Allocator = std::allocator<char>>
class io::execution::basic_poll_multiplexer< Allocator >

A multiplexer that uses the poll system call.

This class is a concrete implementation of the basic_multiplexer that uses the poll system call to wait for I/O events.

Template Parameters
AllocatorThe allocator to use for all allocations.

Constructor & Destructor Documentation

◆ basic_poll_multiplexer()

template<AllocatorLike Allocator = std::allocator<char>>
constexpr io::execution::basic_poll_multiplexer< Allocator >::basic_poll_multiplexer ( const Allocator &  alloc = Allocator())
constexprnoexcept

Default constructor.

Parameters
allocThe allocator to use for all allocations.

Member Function Documentation

◆ set()

template<AllocatorLike Allocator = std::allocator<char>>
template<Completion Fn>
auto io::execution::basic_poll_multiplexer< Allocator >::set ( std::shared_ptr< socket_handle socket,
execution_trigger  trigger,
Fn &&  func 
) -> sender< std::decay_t< Fn > >

Sets a completion handler for an event.

Parameters
socketThe socket to set the completion handler for.
triggerThe event type to trigger on.
funcThe completion handler.
Returns
A sender that will complete when the event occurs.

◆ wait_for()

template<AllocatorLike Allocator = std::allocator<char>>
auto io::execution::basic_poll_multiplexer< Allocator >::wait_for ( interval_type  interval) -> size_type

Waits for events to occur.

Parameters
intervalThe maximum time to wait for, in milliseconds.
Returns
The number of events that occurred.

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