[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TIME, MCL and LOOPS (fwd)
- To: bdrobert@MEDIA-LAB.MEDIA.MIT.EDU
- Subject: Re: TIME, MCL and LOOPS (fwd)
- From: email@example.com (Bill St. Clair)
- Date: Thu, 27 Aug 1992 17:16:53 -0500
- Cc: info-mcl
>>From bdrobert@MEDIA-LAB.MEDIA.MIT.EDU Thu Aug 27 11:25:09 1992
>Subject: TIME, MCL and LOOPS
>Date: Thu, 27 Aug 92 11:26:14 -0400
First I must slap your hand. Please send questions to info-mcl, not
info-mcl-request. info-mcl-request is for requests to be added or
removed from the info-mcl mailing list.
>Any suggestions on an easy way to have a function in your LISP program
>called, every X number of ticks or seconds, without doing a loop.
>I would like the program to be operating in other functions, and every
>so often, it would jump into a function, do stuff, and return to whatever
>task it was doing before.
The documented way of doing this is with *eventhook*. The undocumented
way is with ccl::%install-periodic-task. The former is documented in the
MCL 2.0 reference. The latter is used by the example file "thermometer.lisp":
ccl::%install-periodic-task name function interval &optional flags private-data
Install or overwrite a periodic task with the given NAME (compared
with EQ). Will cause FUNCTION to be funcalled with no arguments once
every INTERVAL ticks (1/60 second). Flags defaults to 0 meaning call
your function no matter what the context. If your function does drawing
or should not be called while event processing is being done, you
should use one or both (logior'd together) of the following values
for FLAGS (both are defined in "ccl:library;lispequ.lisp" so you'll
need to (require "LISPEQU") to use them):
$ptask_draw-flag Your periodic task does drawing
$ptask_event-dispatch-flag Your periodic task should not be called
private-data is stored in the mac heap part of theperiodic task record,
but this will not be useful unless you are writing an interrupt routine
(in LAP or with the foreign function interface) that needs to interact
with a periodic task (I'll give details to anyone who thinks they
need to do this).
Remove the periodic task with the given name.