A timing wheel in a hierarchical set of timing wheels. Each wheel covers 6 bits of precision.
class ref _TimingWheel
Create a timing wheel at the given hierarchical level.
new ref create( index: USize val) : _TimingWheel ref^
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
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
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
Cancels all pending timers.
fun ref clear() : None val
Return the slot for a given time.
fun box _slot( time: U64 val) : U64 val
fun tag _bits() : USize val
fun tag _max() : USize val
fun tag _mask() : U64 val
© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/time-_TimingWheel