help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tea (was: multithreading in Elisp?)


From: lawrence mitchell
Subject: tea (was: multithreading in Elisp?)
Date: Sat, 07 Jun 2003 11:53:14 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50

Michael M Mason wrote:

[...]

> Being a Brit, I couldn't help noticing the rather serious bug in the
> above code snippet.  I hope you won't mind me offering an improved
> version:-

This one looks more reasonable,  I notice you slow down in the
afternoon though.  Is this a bug?

> (defun tea-time ()
>   (message "It's time for tea!"))
> (run-at-time "9:30am" nil 'tea-time)
> (run-at-time "10:00am" nil 'tea-time)
> (run-at-time "11:00am" nil 'tea-time)
> (run-at-time "11:30am" nil 'tea-time)
> (run-at-time "12:00am" nil 'tea-time)
> (run-at-time "1:00pm" nil 'tea-time)
> (run-at-time "2:00pm" nil 'tea-time)
> (run-at-time "3:00pm" nil 'tea-time)
> (run-at-time "3:30pm" nil 'tea-time)
> (run-at-time "4:00pm" nil 'tea-time)
> (run-at-time "5:00pm" nil 'tea-time)

This of course, may be simplified to
(run-at-time "9:30am" (* 30 60) 'tea-time)

You missed one:
(defun close-of-play (&optional reason)
  (call-stumps)
  (run-hooks 'close-of-play-hooks)
  (and reason (message "%s stopped play." reason)))

(if rain-stopped-play
    (close-of-play "Rain")
    (run-at-time "6:00pm" nil 'close-of-play))

HTH
-- 
lawrence mitchell <wence@gmx.li>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]