A hierarchical set of timing wheels.
actor tag Timers
Create a timer handler with the specified number of slop bits. No slop bits means trying for nanosecond resolution. 10 slop bits is approximately microsecond resolution, 20 slop bits is approximately millisecond resolution.
new tag create( slop: USize val = 20) : Timers tag^
Sets a timer. Fire it if need be, schedule it on the right timing wheel, then rearm the timer.
be apply( timer: Timer iso)
Cancels a timer.
be cancel( timer: Timer tag)
Dispose of this set of timing wheels.
When the event fires, advance the timing wheels.
be _event_notify( event: Pointer[AsioEvent val] tag, flags: U32 val, arg: U32 val)
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
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
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
Set the current time with precision reduced by the slop bits. Return the elapsed time.
fun ref _set_time() : U64 val
Get the hierarchical timing wheel for the given time until expiration.
fun ref _get_wheel( rem: U64 val) : _TimingWheel ref ?
Get the maximum time the timing wheels cover. Anything beyond this is scheduled on the last timing wheel.
fun tag _expiration_max() : U64 val
fun tag _wheels() : USize val
fun tag _bits() : USize val
© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.