timer%
A timer% object encapsulates an event-based alarm. To use a
timer, either instantiate it with a timer-callback thunk to perform the alarm-based action, ot derive a new class and override the
notify method to perform the alarm-based action. Start a timer with
start and stop it with
stop. Supplying an initial interval when creating a timer also
starts the timer.
Timers have a relatively high priority in the event queue. Thus, if
the timer delay is set low enough, repeated notification for a timer
can preempt user activities (which might be directed at stopping the
timer). For timers with relatively short delays, call
yield within the
notify procedure to allow guaranteed event processing.
See Eventspaces for more information about event priorities.
( -> new timer% [(notify-callback _)] [(interval _)] [(just-once? _)])timer% object
notify-callback = : procedure of no arguments
void
interval = : exact integer in [0, 1000000000] or #f#f
just-once? = : boolean#f
Creates a timer.
The notify-callback thunk is called by the default
notify method when the timer expires.
If interval is #f (the default), the timer is not
started; in that case,
start must be called explicitly. If interval is a number, then
start is called with interval and just-once?.
Methods
interval
notify
start
stop