[erlisp-devel] mistake in with-timeout?

Eric Lavigne lavigne.eric at gmail.com
Mon Jul 11 20:35:32 UTC 2005


> > I suspect my mistake is in erlisp:with-timeout. Here is a copy of that macro:
> >
> > (defmacro with-timeout ((milliseconds &rest after-timeout) &body body)
> >   #+sbcl `(sb-ext:with-timeout (/ ,milliseconds 1000)
> >             (handler-case (progn , at body)
> >               (sb-ext:timeout () , at after-timeout)))
> >   #+allegro `(mp:with-timeout ((/ ,milliseconds 1000) , at after-timeout)
> >               , at body)
> >   #-(or sbcl allegro) (error
> >                        "Timeouts are not yet implemented for your compiler."))
> >
> > The part I added (probably broken) is prefaced by #+allegro.
> > Dirk's working code is prefaced by #+sbcl.
> 
> That macro looks good to me. I tried it on the allegro cl trial 6.2
> and it works as expected. It is got to be something else.
> 
> Regards,
> DiG

Thanks, Dimitry. I assumed there must be something wrong with my
with-timeout because

1) I didn't really understand it when I wrote it.
2) The SBCL version looked more complicated, so I might be missing something.

But if with-timeout works correctly, then something must have actually
timed out. In other words, I had a speed problem. Once I understood
what to look for, the fix was easy. I already knew my code was slow
(particularly event-wait) but had ignored that because I wanted to
focus on making it work first. All tests pass now, so I'm ready to
send a patch.

Regards,
Eric



More information about the Erlisp-devel mailing list