Class Rev::TimerWatcher
In: ext/rev/rev_buffer.c
Parent: Rev::Watcher

Rev::TimerWatcher lets you create either one-shot or periodic timers which run within Rev‘s event loop. It‘s useful for creating timeouts or events which fire periodically.


attach   detach   disable   enable   new   on_timer   reset  

Public Class methods

Create a new Rev::TimerWatcher for the given IO object and add it to the given Rev::Loop. Interval defines a duration in seconds to wait for events, and can be specified as an Integer or Float. Repeating is a boolean indicating whether the timer is one shot or should fire on the given interval.

Public Instance methods

Attach the timer watcher to the given Rev::Loop. If the watcher is already attached to a loop, detach it from the old one and attach it to the new one.

Detach the timer watcher from its current Rev::Loop.

Temporarily disable a timer watcher which is attached to a loop. This is useful if you wish to toggle event monitoring on and off.

Re-enable a timer watcher which has been temporarily disabled. See the disable method for a more thorough explanation.

Reset the TimerWatcher. This behaves differently depending on if it‘s repeating.

If the timer is pending, its pending status is cleared.

If the timer is attached but nonrepeating, stop it (as if it timed out)

If the timer is repeating, reset it so it will fire again after its given interval