Package ClusterShell :: Package Engine :: Module Engine :: Class EngineBaseTimer
[hide private]
[frames] | no frames]

Class EngineBaseTimer

source code


Abstract class for ClusterShell's engine timer. Such a timer requires a relative fire time (delay) in seconds (as float), and supports an optional repeating interval in seconds (as float too).

See EngineTimer for more information about ClusterShell timers.

Instance Methods [hide private]
 
__init__(self, fire_delay, interval=-1.0, autoclose=False)
Create a base timer.
source code
 
_set_engine(self, engine)
Bind to engine, called by Engine.
source code
 
invalidate(self)
Invalidates a timer object, stopping it from ever firing again.
source code
 
is_valid(self)
Returns a boolean value that indicates whether an EngineTimer object is valid and able to fire.
source code
 
set_nextfire(self, fire_delay, interval=-1)
Set the next firing delay in seconds for an EngineTimer object.
source code
 
_fire(self) source code
Method Details [hide private]

set_nextfire(self, fire_delay, interval=-1)

source code 

Set the next firing delay in seconds for an EngineTimer object.

The optional paramater `interval' sets the firing interval of the timer. If not specified, the timer fires once and then is automatically invalidated.

Time values are expressed in second using floating point values. Precision is implementation (and system) dependent.

It is safe to call this method from the task owning this timer object, in any event handlers, anywhere.

However, resetting a timer's next firing time may be a relatively expensive operation. It is more efficient to let timers autorepeat or to use this method from the timer's own event handler callback (ie. from its ev_timer).