std1.0.0-beta-7 SafeC docs

std :: async::timer

Struct std::Sleep

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

struct Sleep {
    long long duration_ms;
    long long deadline;
    int armed;
    int fired;
    int id;
    int ovf_id;
    struct Waker waker;
    int has_waker;
    ?&TimerQueue tq;
}

Ready (with UNIT) once 'ms' milliseconds have passed since its first poll (Rust's tokio::time::sleep). Needs a context with timers.

Fields

§long long duration_mssource
§long long deadlinesource

set at the first poll (or by until())

§int armedsource

deadline set

§int firedsource

the queue woke it (deadline passed)

§int idsource

TimerQueue registration, 0 = none

§int ovf_idsource

waiting for a free wheel slot (TimerQueue::overflow), 0 = no

§struct Waker wakersource

what the timer wakes

§int has_wakersource

Methods

§static struct Sleep new(long long ms)source · definition
§static struct Sleep until(long long deadline_ms)source · definition

Ready once the executor's clock reaches 'deadline_ms'.

§struct Poll<Unit> poll(&Context cx)source · definition
§void drop()source · definition
§void reset(long long ms)source · definition

Re-arm for 'ms' from the next poll (it may be pending: the old registration is dropped first).

§int is_elapsed() constsource · definition