From ... From: Erik Naggum Subject: Re: throw and catch... Date: 1999/06/21 Message-ID: <3138962515282167@naggum.no>#1/1 X-Deja-AN: 492100958 References: mail-copies-to: never Organization: Naggum Software; +47 8800 8879; http://www.naggum.no Newsgroups: comp.lang.lisp * David Bakhash | First off, what I'm doing is non-standard (it uses multiprocessing). I | have a loop which runs forever. I would like to be able to break out of | it at any time, execute whatever protected forms were necessary, and then | get out of there. But I want to be able to do it from a remote part of | the Lisp world (i.e. a totally separate thread). Basically, like throw | and catch, but not so strict on the lexical/dynamic restrictions. I do this all the time. here's how. in process A, you have: (catch 'interrupt (loop ...)) you need a function INTERRUPT (defun interrupt (&optional value) (ignore-errors (throw 'interrupt value))) now you can do (process-interrupt #'interrupt ) assuming, of course, you have something like Symbolics' multiprocessing, such as supported by Allegro CL. note that INTERRUPT actually executes in process A, i.e., inside the proper dynamic environment. (you want the IGNORE-ERRORS because you have no idea what process A is doing when it is asked to run this function, and you might execute entirely unexpected error handlers if you try to throw to a tag not in scope at the time.) #:Erik -- @1999-07-22T00:37:33Z -- pi billion seconds since the turn of the century