@[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:
s
is not yet running start it and return anAsyncTask
that will resolve once the previously configuredduration
has run out.s
is already or not anymore running return the sameAsyncTask
as the first call towait
.
Equations
Instances For
@[inline]
If:
s
is still running this stopss
without resolving any remainingAsyncTask
s that were created throughwait
. Note that if anotherAsyncTask
is binding on any of these it is going hang forever without further intervention.s
is 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
@[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:
i
is not yet running start it and return anAsyncTask
that resolves right away as the 0th multiple ofduration
has elapsed.i
is already running and:- the tick from the last call of
i
has not yet finished return the sameAsyncTask
as the last call - the tick frrom the last call of
i
has finished return a newAsyncTask
that waits for the closest next tick from the time of calling this function.
- the tick from the last call of
i
is not running aymore this is a no-op.
Equations
Instances For
@[inline]
If:
Interval.tick
was called oni
before the timer restarts counting from now and the next tick happens induration
.i
is not yet or not anymore running this is a no-op.
Instances For
@[inline]
If:
i
is still running this stopsi
without resolving any remaingAsyncTask
that were created throughtick
. Note that if anotherAsyncTask
is binding on any of these it is going hang forever without further intervention.i
is not yet or not anymore running this is a no-op.