Namespace coro

Class List > coro

More...

Classes

Type Name
class continue_on_apc
Move into the designated thread's APC queue and continue the routine.
class continue_on_pthread
Creates a new POSIX Thread and resume the given coroutine handle on it.
class continue_on_thread_pool
Move into the win32 thread pool and continue the routine.
class enumerable <typename T>
C++ Coroutines Generator.
class epoll_owner
RAII wrapping for epoll file descriptor.
class event
RAII + stateful eventfd __
class io_recv
Awaitable type to perform recv I/O request.
class io_recv_from
Awaitable type to perform recvfrom I/O request.
class io_send
Awaitable type to perform send I/O request.
class io_send_to
Awaitable type to perform sendto I/O request.
class io_work_t
A struct to describe "1 I/O request" to system API. When I/O request is submitted, an I/O task becomes 1 coroutine handle.
class kqueue_owner
RAII wrapping for kqueue file descriptor.
class pthread_detacher
Special return type that wraps pthread_detach __
class pthread_joiner
Special return type that wraps pthread_join __
class pthread_spawn_promise
allows pthread_attr_t* forco_await operator
class section
Standard lockable with win32 criticial section.

Public Types

Type Name
typedef gsl::span< std::byte > io_buffer_t
This is simply a view to storage. Be aware that it doesn't have ownership.
typedef void(*)(void *ctx, coroutine_handle< void > coro) net_callback_t

Public Attributes

Type Name
constexpr uint64_t emask = = 1ULL << 63
epoll_owner iep = {}
kqueue_owner netkq = {}
epoll_owner oep = {}

Public Functions

Type Name
GSL_SUPPRESS (f. 4) noexcept
void consume_event (int64_t efd) noexcept
uint32_t get_address (const addrinfo & hint, gsl::czstring<> host, gsl::czstring<> serv, gsl::span< sockaddr_in > output) noexcept
Thin wrapper of getaddrinfo for IPv4.
uint32_t get_address (const addrinfo & hint, gsl::czstring<> host, gsl::czstring<> serv, gsl::span< sockaddr_in6 > output) noexcept
Thin wrapper of getaddrinfo for IPv6.
auto get_address (addrinfo * list) noexcept
auto get_address (addrinfo * list, sockaddr_in addr) noexcept
auto get_address (addrinfo * list, sockaddr_in6 addr) noexcept
int64_t get_eventfd (uint64_t state) noexcept
uint32_t get_io_error (const OVERLAPPED * target) noexcept
int64_t get_io_length (const OVERLAPPED * target) noexcept
uint32_t get_name (const sockaddr_in & addr, gsl::zstring< NI_MAXHOST > name, gsl::zstring< NI_MAXSERV > serv, int32_t flags=NI_NUMERICHOST
uint32_t get_name (const sockaddr_in6 & addr, gsl::zstring< NI_MAXHOST > name, gsl::zstring< NI_MAXSERV > serv, int32_t flags=NI_NUMERICHOST
bool is_async_pending (int ec) noexcept
bool is_signaled (uint64_t state) noexcept
void notify_event (int64_t efd) noexcept
void CALLBACK on_io_done (DWORD errc, DWORD sz, LPWSAOVERLAPPED pover, DWORD flags) noexcept
void poll_net_tasks (uint64_t nano) noexcept
Poll internal I/O works and invoke user callback.
void poll_net_tasks (const timespec & wait_time, net_callback_t callback, void * ctx) noexcept
auto recv_from (uint64_t sd, sockaddr_in & remote, io_buffer_t buf, io_work_t & work) noexcept
Constructs io_recv_from awaitable with the given parameters.
auto recv_from (uint64_t sd, sockaddr_in6 & remote, io_buffer_t buf, io_work_t & work) noexcept
Constructs io_recv_from awaitable with the given parameters.
auto recv_stream (uint64_t sd, io_buffer_t buf, uint32_t flag, io_work_t & work) noexcept
Constructs io_recv awaitable with the given parameters.
void resume_net_task (void *, coroutine_handle< void > coro) noexcept
auto send_stream (uint64_t sd, io_buffer_t buf, uint32_t flag, io_work_t & work) noexcept
Constructs io_send awaitable with the given parameters.
auto send_to (uint64_t sd, const sockaddr_in & remote, io_buffer_t buf, io_work_t & work) noexcept
Constructs io_send_to awaitable with the given parameters.
auto send_to (uint64_t sd, const sockaddr_in6 & remote, io_buffer_t buf, io_work_t & work) noexcept
Constructs io_send_to awaitable with the given parameters.
auto wait_in (epoll_owner & ep, event & efd)
Bind the given event (eventfd ) toepoll_owner (Epoll)
auto zero_overlapped (io_control_block * work) noexcept

Detailed Description

Author:

github.com/luncliff (luncliff@gmail.com)

Public Types Documentation

typedef io_buffer_t

using coro::io_buffer_t = typedef gsl::span<std::byte>;

typedef net_callback_t

using coro::net_callback_t = typedef void (*)(void* ctx, coroutine_handle<void> coro);

Public Attributes Documentation

variable emask

constexpr uint64_t coro::emask;

variable iep

epoll_owner coro::iep;

variable netkq

kqueue_owner coro::netkq;

variable oep

epoll_owner coro::oep;

Public Functions Documentation

function GSL_SUPPRESS

coro::GSL_SUPPRESS (
    f. 4
) noexcept

function consume_event

void coro::consume_event (
    int64_t efd
) noexcept

function get_address

uint32_t coro::get_address (
    const addrinfo & hint,
    gsl::czstring<> host,
    gsl::czstring<> serv,
    gsl::span< sockaddr_in > output
) noexcept

Parameters:

  • hint
  • host
  • serv
  • output

Returns:

uint32_t Error code from the getaddrinfo that can be the argument of gai_strerror

See also: getaddrinfo

See also: gai_strerror

function get_address

uint32_t coro::get_address (
    const addrinfo & hint,
    gsl::czstring<> host,
    gsl::czstring<> serv,
    gsl::span< sockaddr_in6 > output
) noexcept

Parameters:

  • hint
  • host
  • serv
  • output

Returns:

uint32_t Error code from the getaddrinfo that can be the argument of gai_strerror

See also: getaddrinfo

See also: gai_strerror

function get_address

auto coro::get_address (
    addrinfo * list
) noexcept

function get_address

auto coro::get_address (
    addrinfo * list,
    sockaddr_in addr
) noexcept

function get_address

auto coro::get_address (
    addrinfo * list,
    sockaddr_in6 addr
) noexcept

function get_eventfd

int64_t coro::get_eventfd (
    uint64_t state
) noexcept

function get_io_error

uint32_t coro::get_io_error (
    const OVERLAPPED * target
) noexcept

function get_io_length

int64_t coro::get_io_length (
    const OVERLAPPED * target
) noexcept

function get_name

uint32_t coro::get_name (
    const sockaddr_in & addr,
    gsl::zstring< NI_MAXHOST > name,
    gsl::zstring< NI_MAXSERV > serv,
    int32_t flags=NI_NUMERICHOST|NI_NUMERICSERV
) noexcept

Parameters:

  • addr
  • name
  • serv can be nullptr
  • flags

Returns:

uint32_t EAI_AGAIN ...

See also: getnameinfo

function get_name

uint32_t coro::get_name (
    const sockaddr_in6 & addr,
    gsl::zstring< NI_MAXHOST > name,
    gsl::zstring< NI_MAXSERV > serv,
    int32_t flags=NI_NUMERICHOST|NI_NUMERICSERV
) noexcept

Parameters:

  • addr
  • name
  • serv can be nullptr
  • flags

Returns:

uint32_t EAI_AGAIN ...

See also: getnameinfo

function is_async_pending

bool coro::is_async_pending (
    int ec
) noexcept

function is_signaled

bool coro::is_signaled (
    uint64_t state
) noexcept

function notify_event

void coro::notify_event (
    int64_t efd
) noexcept

function on_io_done

void CALLBACK coro::on_io_done (
    DWORD errc,
    DWORD sz,
    LPWSAOVERLAPPED pover,
    DWORD flags
) noexcept

function poll_net_tasks

void coro::poll_net_tasks (
    uint64_t nano
) noexcept

Parameters:

  • nano timeout in nanoseconds

Exception:

  • std::system_error

function poll_net_tasks

void coro::poll_net_tasks (
    const timespec & wait_time,
    net_callback_t callback,
    void * ctx
) noexcept

function recv_from

auto coro::recv_from (
    uint64_t sd,
    sockaddr_in & remote,
    io_buffer_t buf,
    io_work_t & work
) noexcept

Parameters:

  • sd
  • remote
  • buf
  • work

Returns:

io_recv_from&

function recv_from

auto coro::recv_from (
    uint64_t sd,
    sockaddr_in6 & remote,
    io_buffer_t buf,
    io_work_t & work
) noexcept

Parameters:

  • sd
  • remote
  • buf
  • work

Returns:

io_recv_from&

function recv_stream

auto coro::recv_stream (
    uint64_t sd,
    io_buffer_t buf,
    uint32_t flag,
    io_work_t & work
) noexcept

Parameters:

  • sd
  • buf
  • flag
  • work

Returns:

io_recv&

function resume_net_task

void coro::resume_net_task (
    void *,
    coroutine_handle < void > coro
) noexcept

function send_stream

auto coro::send_stream (
    uint64_t sd,
    io_buffer_t buf,
    uint32_t flag,
    io_work_t & work
) noexcept

Parameters:

  • sd
  • buf
  • flag
  • work

Returns:

io_send&

function send_to

auto coro::send_to (
    uint64_t sd,
    const sockaddr_in & remote,
    io_buffer_t buf,
    io_work_t & work
) noexcept

Parameters:

  • sd
  • remote
  • buf
  • work

Returns:

io_send_to&

function send_to

auto coro::send_to (
    uint64_t sd,
    const sockaddr_in6 & remote,
    io_buffer_t buf,
    io_work_t & work
) noexcept

Parameters:

  • sd
  • remote
  • buf
  • work

Returns:

io_send_to&

function wait_in

auto coro::wait_in (
    epoll_owner & ep,
    event & efd
) 

Parameters:

See also: event

Returns:

awaitable struct for the binding

function zero_overlapped

auto coro::zero_overlapped (
    io_control_block * work
) noexcept

The documentation for this class was generated from the following file interface/coroutine/linux.h