std :: async::future
Struct std::TimerQueue
struct TimerQueue {
struct TimerWheel wheel;
long long origin_ms;
int started;
struct Spinlock lock;
struct WaitList overflow;
long long ovf_min;
}The executor's timer queue (implemented in timer.sc; Sleep, Interval and the queue's role are described in std/async/timer.h). Declared here because Context points at one.
Fields
tick = 1 ms since origin_ms
clock value of tick 0
origin set (by the first advance)
Sleeps that found the wheel full wait here, and are woken to retry when a wheel slot frees up or the earliest of their deadlines comes.
earliest deadline waiting in 'overflow', -1 if none
Methods
Moves the queue's clock to 'now_ms' (never backwards) and wakes every timer due by then. The first call sets the origin. Returns how many fired.
The current time: what the last advance() was given.
The earliest pending deadline, or -1 if no timer is pending.
Milliseconds from now to the earliest deadline (0 if already due), or -1 if no timer is pending: how long an executor may park.
Releases the wakers of Sleeps still waiting for a wheel slot. Every Sleep must be dropped before its queue is.