timer

Class

Package: common-graphics

See About the Common Graphics timer facility in cgide.htm.

The class of timer objects. A timer can be used to cause an arbitrary piece of application code to be asynchronously invoked after a specified amount of time has elapsed. A timer can then be stopped in order to run its code a single time only, or it can be allowed to continue running in order to run its code an indefinite number of times at a regular time interval.

A single timer can be started and stopped a number of times, using various time intervals, to time a number of different activities. If multiple activities need to be timed simultaneously, then multiple timers can be created and run alongside each other. It is also convenient to create a separate timer for each piece of code that is to be invoked by timers, even when they do not need to run simultaneously.

A timer has the following properties. All of these except for id may be set by an application.

name: an arbitrary symbol that is used to find a timer (by calling find-timer), or to distinguish an individual timer during development and debugging.

active: a boolean value indicating whether a timer is currently running: an active timer "fires" each time its interval passes, while an inactive timer does nothing. This property of a timer will be non-nil if start-timer has been called on the timer more recently than stop-timer has. If the active property is explicitly modified by an application from nil to non-nil, then start-timer is called internally, and if the active property is explicitly modified from non-nil to nil, then stop-timer is called internally. Therefore, in order to wrap all starting and stopping of timers, it is sufficient to add start-timer and stop-timer methods.

id: a positive integer that is assigned and used by the operating system to uniquely identify a particular timer. An application should never modify this property, but may want to check its value for debugging purposes (for example, to see which timer id is being passed to a win:WM_TIMER method). Any given timer object will always use the same id, and no other timer object will use that id.

interval: a positive integer indicating the number of milliseconds after a timer is started that it will "fire" by calling the generic function timer. The interval default-initarg for the timer class is 1000, which will fire the timer once a second.

on-timer: the name of a function that is invoked after the timer's interval has elapsed (assuming that the default timer method has not been overridden).

timer-count: a non-negative integer indicating the number of times that a timer's interval has elapsed since it was most recently started.

timer-info: a place for an application to store arbitrary information about its current use of a timer.

Common Graphics and IDE documentation is described in About Common Graphics and IDE documentation in cgide.htm.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.