W3cubDocs

/Pony

_TimingWheel

[Source]

A timing wheel in a hierarchical set of timing wheels. Each wheel covers 6 bits of precision.

class ref _TimingWheel

Constructors

create

[Source]

Create a timing wheel at the given hierarchical level.

new ref create(
  index: USize val)
: _TimingWheel ref^

Parameters

Returns

Public Functions

schedule

[Source]

Schedule a timer on this wheel. Mark the bit indicating that the given slot has timers in its list.

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

Parameters

Returns

advance

[Source]

Remove pending timers from this timing wheel and put them on the pending list supplied. Needs the current time and the elapsed time since the previous advance. Returns true if the next timing wheel in the hierarchy should be advanced.

fun ref advance(
  list: List[Timer ref] ref,
  current: U64 val,
  elapsed: U64 val)
: Bool val

Parameters

Returns

next

[Source]

Given a current time, return the next time at which this timing wheel should be advanced. Returns -1 if no timers are on this timing wheel.

fun box next(
  current: U64 val)
: U64 val

Parameters

  • current: U64 val

Returns

clear

[Source]

Cancels all pending timers.

fun ref clear()
: None val

Returns

Private Functions

_slot

[Source]

Return the slot for a given time.

fun box _slot(
  time: U64 val)
: U64 val

Parameters

  • time: U64 val

Returns

_bits

[Source]

fun tag _bits()
: USize val

Returns

_max

[Source]

fun tag _max()
: USize val

Returns

_mask

[Source]

fun tag _mask()
: U64 val

Returns

© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/time-_TimingWheel