std1.0.0-beta-7 SafeC docs

std :: async::future

Struct std::WaitList

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

struct WaitList {
    struct Waker w[ASYNC_WAITERS];
    int serial[ASYNC_WAITERS];
    int count;
    int next_serial;
}

Fields

0 = free, else the registration's serial

§int countsource
§int next_serialsource

Methods

§static struct WaitList new()source · definition
§int add(int id, const &Waker w)source · definition

Register (or, with the id of a live registration, refresh) a waiter. Returns its id, 0 if full.

§void remove(int id)source · definition

Remove a registration (a stale or 0 id is ignored).

§int contains(int id) constsource · definition

Whether 'id' is still registered (not woken or removed yet).

§int wake_one()source · definition

Wake (and remove) one waiter. Returns 1 if there was one.

§int wake_all()source · definition

Wake (and remove) every waiter. Returns how many.

§int len() constsource · definition
§void drop()source · definition

Releases every registered waker (without waking it). A WaitList owns the waker clones registered in it, so whatever holds one (a mutex, a channel, a timer queue) drops it.