Package ivy :: Module ivy :: Class IvyTimer
[hide private]
[frames] | no frames]

Class IvyTimer

source code

        object --+        
                 |        
threading._Verbose --+    
                     |    
      threading.Thread --+
                         |
                        IvyTimer

An IvyTimer object is responsible for calling a function regularly. It is bound to an IvyServer and stops when its server stops.

Interacting with a timer object

MT-safety

Please note: start() starts a new thread; if the same function is given as the callback to different timers, that function should be prepared to be called concurrently. Specifically, if the callback accesses shared variables, they should be protected against concurrency problems (using locks e.g.).

Instance Methods [hide private]
 
__init__(self, server, nbticks, delay, callback)
Creates a new timer.
source code
 
run(self) source code

Inherited from threading.Thread: __repr__, getName, isAlive, isDaemon, join, setDaemon, setName, start

Inherited from threading.Thread (private): _set_daemon

Inherited from threading._Verbose (private): _note

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, server, nbticks, delay, callback)
(Constructor)

source code 
Creates a new timer. After creation, call the timer's start() method to activate it.
Parameters:
  • server - the IvyServer related to this timer --when the server stops, so does the timer.
  • nbticks - the number of repetition to make. 0 (zero) means: endless loop
  • delay - the delay, in milliseconds, between two ticks
  • callback - a function called at each tick. This function is called with one parameter, the timer itself
Overrides: object.__init__

run(self)

source code 
Overrides: threading.Thread.run