std1.0.0-beta-7 SafeC docs

std :: async::timer

Struct std::Interval

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

struct Interval {
    long long period_ms;
    long long next_ms;
    long long ticks;
    struct Sleep sleep;
    int started;
}

A periodic timer (tokio::time::interval): every poll that returns Ready gives the number of the tick (1, 2, 3, ...), one per 'period_ms', the first one 'period_ms' after the first poll. Unlike a plain future it is polled again after Ready — it is a stream of ticks. Missed ticks (the task was busy) are delivered back to back, then the schedule continues (tokio's MissedTickBehavior::Burst).

Fields

§long long period_mssource
§long long next_mssource

deadline of the next tick

§long long tickssource
§struct Sleep sleepsource
§int startedsource

Methods

§static struct Interval new(long long period_ms)source · definition
§struct Poll<long long> poll(&Context cx)source · definition
§void drop()source · definition