Dear Erlisp developers,
I need some help to figure out a problem with my code. I am trying to add Allegro support to Erlisp, but I ran into some trouble as shown in this test result:
...........f........................ Did 36 checks. Pass: 35 (97%) Skip: 0 (0%) Fail: 1 (2%)
Failure Details: RECEIVE-WITH-TIMEOUT []: NIL.
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 ,@body) (sb-ext:timeout () ,@after-timeout))) #+allegro `(mp:with-timeout ((/ ,milliseconds 1000) ,@after-timeout) ,@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. Documentation on the allegro with-timeout macro is available here: http://www.franz.com/support/documentation/6.2/doc/pages/operators/mp/with-t...
A complete copy of compatibility.lisp (the only modified file) is available here: http://plaza.ufl.edu/lavigne/compatibility.lisp Hopefully you can figure out my mistake so Erlisp can work on one more compiler. I would appreciate any ideas about what might be wrong. Eric
On 7/11/05, Eric Lavigne lavigne.eric@gmail.com wrote:
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 ,@body) (sb-ext:timeout () ,@after-timeout))) #+allegro `(mp:with-timeout ((/ ,milliseconds 1000) ,@after-timeout) ,@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
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 ,@body) (sb-ext:timeout () ,@after-timeout))) #+allegro `(mp:with-timeout ((/ ,milliseconds 1000) ,@after-timeout) ,@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