Documentation

Std.Internal.Async.Timer

Sleep can be used to sleep for some duration once. The underlying timer has millisecond resolution.

@[inline]

Set up a Sleep that waits for duration milliseconds. This function only initializes but does not yet start the timer.

Equations
@[inline]

If:

  • s is not yet running start it and return an AsyncTask that will resolve once the previously configured duration has run out.
  • s is already or not anymore running return the same AsyncTask as the first call to wait.
Equations
@[inline]

If:

  • s is still running the timer restarts counting from now and finishes after duration milliseconds.
  • s is not yet or not anymore running this is a no-op.
Equations
@[inline]

If:

  • s is still running this stops s without resolving any remaining AsyncTasks that were created through wait. Note that if another AsyncTask 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.
Equations

Return an AsyncTask that resolves after duration.

Equations

Interval can be used to repeatedly wait for some duration like a clock. The underlying timer has millisecond resolution.

@[inline]

Setup up an Interval that waits for duration milliseconds. This function only initializes but does not yet start the timer.

Equations
@[inline]

If:

  • i is not yet running start it and return an AsyncTask that resolves right away as the 0th multiple of duration has elapsed.
  • i is already running and:
    • the tick from the last call of i has not yet finished return the same AsyncTask as the last call
    • the tick frrom the last call of i has finished return a new AsyncTask that waits for the closest next tick from the time of calling this function.
  • i is not running aymore this is a no-op.
Equations
@[inline]

If:

  • Interval.tick was called on i before the timer restarts counting from now and the next tick happens in duration.
  • i is not yet or not anymore running this is a no-op.
Equations
@[inline]

If:

  • i is still running this stops i without resolving any remaing AsyncTask that were created through tick. Note that if another AsyncTask 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.
Equations