W3cubDocs

/Pony

Timers

[Source]

A hierarchical set of timing wheels.

actor tag Timers

Constructors

create

[Source]

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^

Parameters

Returns

Public Behaviours

apply

[Source]

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

[Source]

Cancels a timer.

be cancel(
  timer: Timer tag)

Parameters

dispose

[Source]

Dispose of this set of timing wheels.

be dispose()

Private Behaviours

_event_notify

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

fun ref _set_time()
: U64 val

Returns

_get_wheel

[Source]

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

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

Parameters

Returns

_expiration_max

[Source]

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

[Source]

fun tag _wheels()
: USize val

Returns

_bits

[Source]

fun tag _bits()
: USize val

Returns

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