home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / lisp / mcl / 1330 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  2.7 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!bill@cambridge.apple.com
  2. From: bill@cambridge.apple.com (Bill St. Clair)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: TIME, MCL and LOOPS (fwd)
  5. Message-ID: <9208272110.AA16814@cambridge.apple.com>
  6. Date: 27 Aug 92 22:16:53 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 47
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10. Full-Name: Bill St. Clair
  11. Original-To: bdrobert@MEDIA-LAB.MEDIA.MIT.EDU
  12. Original-Cc: info-mcl
  13.  
  14. >Forwarded message:
  15. >
  16. >>From bdrobert@MEDIA-LAB.MEDIA.MIT.EDU Thu Aug 27 11:25:09 1992
  17. >Message-Id: <9208271526.AA03549@media-lab.mit.edu>
  18. >To: info-mcl-request@cambridge.apple.com
  19. >Subject: TIME, MCL and LOOPS
  20. >Date: Thu, 27 Aug 92 11:26:14 -0400
  21. >From: bdrobert@MEDIA-LAB.MEDIA.MIT.EDU
  22. >X-Mts: smtp
  23.  
  24. First I must slap your hand. Please send questions to info-mcl, not
  25. info-mcl-request. info-mcl-request is for requests to be added or
  26. removed from the info-mcl mailing list.
  27.  
  28. >
  29. >Any suggestions on an easy way to have a function in your LISP program
  30. >called, every X number of ticks or seconds, without doing a loop.
  31. >I would like the program to be operating in other functions, and every
  32. >so often, it would jump into a function, do stuff, and return to whatever
  33. >task it was doing before.
  34.  
  35. The documented way of doing this is with *eventhook*. The undocumented
  36. way is with ccl::%install-periodic-task. The former is documented in the
  37. MCL 2.0 reference. The latter is used by the example file "thermometer.lisp":
  38.  
  39. ccl::%install-periodic-task name function interval &optional flags private-data
  40.   Install or overwrite a periodic task with the given NAME (compared
  41.   with EQ). Will cause FUNCTION to be funcalled with no arguments once
  42.   every INTERVAL ticks (1/60 second). Flags defaults to 0 meaning call
  43.   your function no matter what the context. If your function does drawing
  44.   or should not be called while event processing is being done, you
  45.   should use one or both (logior'd together) of the following values
  46.   for FLAGS (both are defined in "ccl:library;lispequ.lisp" so you'll
  47.   need to (require "LISPEQU") to use them):
  48.  
  49.   $ptask_draw-flag            Your periodic task does drawing
  50.   $ptask_event-dispatch-flag  Your periodic task should not be called
  51.                               during EVENT-DISPATCH.
  52.  
  53.   private-data is stored in the mac heap part of theperiodic task record,
  54.   but this will not be useful unless you are writing an interrupt routine
  55.   (in LAP or with the foreign function interface) that needs to interact
  56.   with a periodic task (I'll give details to anyone who thinks they
  57.   need to do this).
  58.  
  59. ccl::%remove-periodic-task name
  60.   Remove the periodic task with the given name.
  61.