@[inline]
Set up a Sleep that waits for duration milliseconds.
This function only initializes but does not yet start the timer.
Equations
- Std.Internal.IO.Async.Sleep.mk duration = do let native ← Std.Internal.UV.Timer.mk (Std.Time.Internal.UnitVal.toInt duration).toNat.toUInt64 false pure { native := native }
Instances For
@[inline]
If:
sis not yet running start it and return anAsyncTaskthat will resolve once the previously configureddurationhas run out.sis already or not anymore running return the sameAsyncTaskas the first call towait.
Equations
Instances For
@[inline]
If:
sis still running this stopsswithout resolving any remainingAsyncTasks that were created throughwait. Note that if anotherAsyncTaskis binding on any of these it is going hang forever without further intervention.sis not yet or not anymore running this is a no-op.
Instances For
Return an AsyncTask that resolves after duration.
Equations
- Std.Internal.IO.Async.sleep duration = do let sleeper ← Std.Internal.IO.Async.Sleep.mk duration sleeper.wait
Instances For
Return a Selector that resolves after duration.
Equations
- Std.Internal.IO.Async.Selector.sleep duration = do let sleeper ← Std.Internal.IO.Async.Sleep.mk duration sleeper.selector
Instances For
@[inline]
Setup up an Interval that waits for duration milliseconds.
This function only initializes but does not yet start the timer.
Equations
- Std.Internal.IO.Async.Interval.mk duration x✝ = do let native ← Std.Internal.UV.Timer.mk (Std.Time.Internal.UnitVal.toInt duration).toNat.toUInt64 true pure { native := native }
Instances For
@[inline]
If:
iis not yet running start it and return anAsyncTaskthat resolves right away as the 0th multiple ofdurationhas elapsed.iis already running and:- the tick from the last call of
ihas not yet finished return the sameAsyncTaskas the last call - the tick from the last call of
ihas finished return a newAsyncTaskthat waits for the closest next tick from the time of calling this function.
- the tick from the last call of
iis not running anymore this is a no-op.
Equations
Instances For
@[inline]
If:
Interval.tickwas called onibefore the timer restarts counting from now and the next tick happens induration.iis not yet or not anymore running this is a no-op.
Instances For
@[inline]
If:
iis still running this stopsiwithout resolving any remainingAsyncTaskthat were created throughtick. Note that if anotherAsyncTaskis binding on any of these it is going hang forever without further intervention.iis not yet or not anymore running this is a no-op.