std1.0.0-beta-7 SafeC docs

std :: async::net

Struct std::IoDriver

#include <std/async/net.h> source

struct IoDriver {
    struct Reactor reactor;
    int ok;
    struct IoWaiter waiters[ASYNC_IO_WAITERS];
    int nwaiting;
    int next_serial;
    int wake_rd;
    int wake_wr;
    int wake_pending;
    long long events;
}

Fields

§struct Reactor reactorsource
§int oksource

reactor opened

§int nwaitingsource
§int next_serialsource
§int wake_rdsource

wake pipe (POSIX), -1 if none

§int wake_wrsource
§int wake_pendingsource

atomic: a byte is in the pipe (or an unpark is pending)

§long long eventssource

statistics: readiness events seen

Methods

§static struct IoDriver new()source · definition
§int init()source · definition

Opens the OS event queue (and the wake pipe). 0 on success.

§int wait(int fd, int filter, const &Waker w, int id)source · definition

Wake 'w' once 'fd' is ready for 'filter'. 'id' is a previous registration of the same future (refreshed), or 0. Returns the registration id, 0 if the table is full (re-poll instead).

§void cancel(int id)source · definition
§int waiting() constsource · definition
§long long now_ms()source · definition

Park (std/async/executor.h): the OS clock, and waiting in the reactor.

§void park(long long timeout_ms)source · definition
§void unpark()source · definition