Timers

A hierarchical set of timing wheels.

actor tag Timers

Constructors

create

new tag create(
  slop: USize val = seq)
: Timers tag^

Parameters

Returns


Public Behaviours

apply

Sets a timer. Fire it if need be, schedule it on the right timing wheel, then rearm the timer.

be apply(
  timer: Timer iso)

Parameters


cancel

Cancels a timer.

be cancel(
  timer: Timer tag)

Parameters


dispose

Dipose of this set of timing wheels.

be dispose()

Private Behaviours

_event_notify

When the event fires, advance the timing wheels.

be _event_notify(
  event: Pointer[AsioEvent val] tag,
  flags: U32 val,
  arg: U32 val)

Parameters


Private Functions

_advance

Update the current time, process all the timing wheels, and set the event for the next time we need to advance.

fun ref _advance()
: None val

Returns


_fire

Fire a timer if necessary, then schedule it on the correct timing wheel based on how long it is until it expires.

fun ref _fire(
  timer: Timer ref)
: None val

Parameters

Returns


_next

Return the next time at which the timing wheels should be advanced. This is adjusted for slop, so it yields nanoseconds. If no events are pending, this returns -1.

fun box _next()
: U64 val

Returns


_set_time

Set the current time with precision reduced by the slop bits. Return the elapsed time.

fun ref _set_time()
: U64 val

Returns


_get_wheel

Get the hierarchical timing wheel for the given time until expiration.

fun ref _get_wheel(
  rem: U64 val)
: _TimingWheel ref ?

Parameters

Returns


_expiration_max

Get the maximum time the timing wheels cover. Anything beyond this is scheduled on the last timing wheel.

fun tag _expiration_max()
: U64 val

Returns


_wheels

fun tag _wheels()
: USize val

Returns


_bits

fun tag _bits()
: USize val

Returns