TimerHandler(3)

CLASS
tcl.lang.TimerHandler -- Subclass from this abstract base class to create timer event handlers.

METHODS

Timerhandler(Notifier notifier, int milliseconds)

synchronized void cancel()

abstract void processTimerEvent()

ARGUMENTS
The Notifier in which to register the new TimerHandler.

How many milliseconds should be elapsed before the timer is fired.

DESCRIPTION
The TimerHandler class is used to schedule code to be executed in a future time. To write your own timer handler, subclass from TimerHandler and override the processTimerEvent method.

The callback to processTimerEvent will be made by the notifier, so the TimerHandler class is only useful in programs that dispatch events through notifier.doOneEvent or through Tcl commands such as vwait. The call to processTimerEvent may not be made at the exact time given by milliseconds: it will be made at the next opportunity after that time. For example, if notifier.doOneEvent isn't called until long after the time has elapsed, or if there are other pending events to process before the call to processTimerEvent, then the call to processTimerEvent will be delayed.

TimerHandler
    This constructor creates a TimerHandler instance and register it inside the given notifier.

cancel
    If the processTimerEvent method has not been invoked yet, cancels this timer handler. If the processTimerEvent method has already been invoked by the notifier, this call has no effect.

processTimerEvent
    You can override this method to perform the desired actions when the timer is fired. The TimerHandler instance can be created in any thread. However, processTimerEvent is always called in the primary thread of the notifier that was specified in the TimerHandler constructor.

EQUIVALENT C FUNCTIONS
Tcl_CreateTimerHandler

SEE ALSO
Notifier, IdleHandler

KEYWORDS
timer, event, event queue