All Manuals > LispWorks® User Guide and Reference Manual > 42 The MP Package

schedule-timer-relative-milliseconds Function

Summary

Schedules a timer to expire at a given time after this function is called.

Package

mp

Signature

schedule-timer-relative-milliseconds timer relative-expiration-time &optional repeat-time => timer

Arguments
timer
A timer.
relative-expiration-time
A non-negative real or nil.
repeat-time
A non-negative real or nil.
Values
timer
A timer.
Description

The function schedule-timer-relative-milliseconds schedules a timer to expire at a given time after the call to the function. timer is a timer returned by make-timer or make-named-timer. relative-expiration-time is a non-negative real number of milliseconds after the call to the function at which timer is to expire. If repeat-time is specified, it is a non-negative real number of milliseconds that specifies a repeat interval. Each time timer expires, it is rescheduled to expire after this repeat interval.

If timer is already scheduled to expire at the time this function is called, it is rescheduled to expire at the time specified by relative-expiration-time. If that argument is nil, timer is not rescheduled, but the repeat interval is set to the interval specified by repeat-time.

If timer is not scheduled or has already expired and relative-expiration-time is nil and repeat-time is non-nil, then timer is scheduled to the current time plus repeat-time. Note: this is new in LispWorks 8.0. In previous versions, this would have signaled an error.

The function schedule-timer-milliseconds schedules a timer to expire at a time relative to the start of the program.

Notes

schedule-timer-relative-milliseconds has the same precision as schedule-timer-relative, but may avoid some allocation when computing the time.

Examples

The following example schedules a timer to expire 5 seconds after the call to schedule-timer-relative-milliseconds and every 5 seconds thereafter.

(setq timer
      (mp:make-timer 'print 10 *standard-output*))
#<Time Event : PRINT>
(mp:schedule-timer-relative-milliseconds timer 5000
 5000)
#<Time Event : PRINT>
See also

make-named-timer
make-timer
schedule-timer
schedule-timer-milliseconds
schedule-timer-relative
timer-expired-p
timer-name
unschedule-timer


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:51