MySQL 8.4.0
Source Code Documentation
net::linux_epoll_io_service Class Reference

#include <linux_epoll_io_service.h>

Inheritance diagram for net::linux_epoll_io_service:
[legend]

Classes

class  FdInterest
 

Public Types

using native_handle_type = impl::socket::native_handle_type
 
- Public Types inherited from net::IoServiceBase
using native_handle_type = impl::socket::native_handle_type
 

Public Member Functions

 ~linux_epoll_io_service () override
 
bool is_open () const noexcept
 
stdx::expected< void, std::error_code > open () noexcept override
 open the io-service. More...
 
void on_notify ()
 
void notify () override
 notify the poll_one() that something may have changed. More...
 
stdx::expected< void, std::error_code > close ()
 
stdx::expected< void, std::error_code > add_fd_interest (native_handle_type fd, impl::socket::wait_type wt) override
 
stdx::expected< void, std::error_code > add_fd_interest_permanent (native_handle_type fd, impl::socket::wait_type wt)
 
stdx::expected< void, std::error_code > remove_fd (native_handle_type fd) override
 
stdx::expected< void, std::error_code > remove_fd_interest (native_handle_type fd, uint32_t revents)
 
std::optional< int32_t > interest (native_handle_type fd) const
 get current fd-interest. More...
 
stdx::expected< fd_event, std::error_code > pop_event ()
 
stdx::expected< fd_event, std::error_code > update_fd_events (std::chrono::milliseconds timeout)
 
stdx::expected< fd_event, std::error_code > poll_one (std::chrono::milliseconds timeout) override
 poll one event from the registered fd-interest. More...
 
- Public Member Functions inherited from net::IoServiceBase
virtual ~IoServiceBase ()=default
 

Static Public Attributes

static constexpr const int kSettableEvents = EPOLLIN | EPOLLOUT
 
static constexpr const int kAlwaysEnabledEvents = EPOLLHUP | EPOLLERR
 
static constexpr const int kAllEvents
 

Private Member Functions

stdx::expected< void, std::error_code > after_event_fired (int epfd, native_handle_type fd, uint32_t revents)
 

Private Attributes

FdInterest registered_events_
 
std::mutex fd_events_mtx_
 
std::array< epoll_event, 8192 > fd_events_ {}
 
size_t fd_events_processed_ {0}
 
size_t fd_events_size_ {0}
 
impl::file::file_handle_type epfd_ {impl::file::kInvalidHandle}
 
std::pair< impl::file::file_handle_type, impl::file::file_handle_typewakeup_fds_ {impl::file::kInvalidHandle, impl::file::kInvalidHandle}
 
impl::file::file_handle_type notify_fd_ {impl::file::kInvalidHandle}
 

Member Typedef Documentation

◆ native_handle_type

Constructor & Destructor Documentation

◆ ~linux_epoll_io_service()

net::linux_epoll_io_service::~linux_epoll_io_service ( )
inlineoverride

Member Function Documentation

◆ add_fd_interest()

stdx::expected< void, std::error_code > net::linux_epoll_io_service::add_fd_interest ( native_handle_type  fd,
impl::socket::wait_type  wt 
)
inlineoverridevirtual

Implements net::IoServiceBase.

◆ add_fd_interest_permanent()

stdx::expected< void, std::error_code > net::linux_epoll_io_service::add_fd_interest_permanent ( native_handle_type  fd,
impl::socket::wait_type  wt 
)
inline

◆ after_event_fired()

stdx::expected< void, std::error_code > net::linux_epoll_io_service::after_event_fired ( int  epfd,
native_handle_type  fd,
uint32_t  revents 
)
inlineprivate

◆ close()

stdx::expected< void, std::error_code > net::linux_epoll_io_service::close ( )
inline

◆ interest()

std::optional< int32_t > net::linux_epoll_io_service::interest ( native_handle_type  fd) const
inline

get current fd-interest.

Returns
fd-interest as bitmask of raw EPOLL* flags

◆ is_open()

bool net::linux_epoll_io_service::is_open ( ) const
inlinenoexcept

◆ notify()

void net::linux_epoll_io_service::notify ( )
inlineoverridevirtual

notify the poll_one() that something may have changed.

can be called from another thread then poll_one().

Implements net::IoServiceBase.

◆ on_notify()

void net::linux_epoll_io_service::on_notify ( )
inline

◆ open()

stdx::expected< void, std::error_code > net::linux_epoll_io_service::open ( )
inlineoverridevirtualnoexcept

open the io-service.

MUST be called before any of the other functions is called.

may fail if out of file-descriptors.

Returns
an std::error_code on error

Implements net::IoServiceBase.

◆ poll_one()

stdx::expected< fd_event, std::error_code > net::linux_epoll_io_service::poll_one ( std::chrono::milliseconds  timeout)
inlineoverridevirtual

poll one event from the registered fd-interest.

removes the interest of the event that fired

Parameters
timeoutwait at most timeout milliseconds
Returns
fd_event which fired
Return values
std::errc::timed_outin case of timeout

Implements net::IoServiceBase.

◆ pop_event()

stdx::expected< fd_event, std::error_code > net::linux_epoll_io_service::pop_event ( )
inline

◆ remove_fd()

stdx::expected< void, std::error_code > net::linux_epoll_io_service::remove_fd ( native_handle_type  fd)
inlineoverridevirtual

Implements net::IoServiceBase.

◆ remove_fd_interest()

stdx::expected< void, std::error_code > net::linux_epoll_io_service::remove_fd_interest ( native_handle_type  fd,
uint32_t  revents 
)
inline

◆ update_fd_events()

stdx::expected< fd_event, std::error_code > net::linux_epoll_io_service::update_fd_events ( std::chrono::milliseconds  timeout)
inline

Member Data Documentation

◆ epfd_

impl::file::file_handle_type net::linux_epoll_io_service::epfd_ {impl::file::kInvalidHandle}
private

◆ fd_events_

std::array<epoll_event, 8192> net::linux_epoll_io_service::fd_events_ {}
private

◆ fd_events_mtx_

std::mutex net::linux_epoll_io_service::fd_events_mtx_
private

◆ fd_events_processed_

size_t net::linux_epoll_io_service::fd_events_processed_ {0}
private

◆ fd_events_size_

size_t net::linux_epoll_io_service::fd_events_size_ {0}
private

◆ kAllEvents

constexpr const int net::linux_epoll_io_service::kAllEvents
staticconstexpr
Initial value:
=
static constexpr const int kAlwaysEnabledEvents
Definition: linux_epoll_io_service.h:63
static constexpr const int kSettableEvents
Definition: linux_epoll_io_service.h:62

◆ kAlwaysEnabledEvents

constexpr const int net::linux_epoll_io_service::kAlwaysEnabledEvents = EPOLLHUP | EPOLLERR
staticconstexpr

◆ kSettableEvents

constexpr const int net::linux_epoll_io_service::kSettableEvents = EPOLLIN | EPOLLOUT
staticconstexpr

◆ notify_fd_

impl::file::file_handle_type net::linux_epoll_io_service::notify_fd_ {impl::file::kInvalidHandle}
private

◆ registered_events_

FdInterest net::linux_epoll_io_service::registered_events_
private

◆ wakeup_fds_


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