[slime-devel] Re: interrupt and multiple processes

Alan Ruttenberg alanralanr at comcast.net
Thu Jan 8 16:34:34 UTC 2004


On Jan 8, 2004, at 11:07 AM, Luke Gorrie wrote:

> Alan Ruttenberg <alanralanr at comcast.net> writes:
>
>> When there are multiple processes and an interrupt is sent,
>> lisp(openmcl in my case) needs to know which process to interrupt.
>> So when the interrupt is being processed I need to ask emacs for that
>> information before choosing the process to interrupt.
>> What's the proper way to do that?
>
> I don't think there is a proper way as of today. The Emacs side has no
> notion of threads, so is there anything useful it can tell Lisp at
> all?
>
I  was thinking that you would interrupt only from a given repl. 
ccl::*current-process* in a repl gives you  a handle on the thread. 
Could just make the process name or some other identifier a buffer 
local variable.

> How will you interrupt a specific thread in OpenMCL? Do they each have
> their own OS PID such that you could SIGINT the right one, or is it
> necessary to do a (interrupt-thread T) sort of call inside Lisp? (I
> think the first will work in SBCL and the second will be needed in
> CMUCL).
>

Openmcl only knows which thread to interrupt through a global variable 
that is checked during the housekeeping routine that notices that there 
was an interrupt.  In the one repl world I was  setting that variable 
when the connection was being opened.

My thought was that when you run slime-interrupt you record the repl 
from which it was executed. Then when lisp processes the interrupt 
instead of looking at it's global it makes a call back to emacs asking 
for the name of the process associated with the repl from which slime 
interrupt was called.
It's basically another oob event except it needs to get a string 
response.


> If the second, a temporary hack could be to have Emacs send
> e.g. SIGUSR1 and Lisp have a handler that knows to interrupt the Swank
> request-handler thread, or something..
>
>> Also regarding multiple processes: I'm running portable aserve and
>> would like to be able to have errors that occur in the server
>> processes
>> create a slime debugger instance. Is there a way to set that up, given
>> that those processes are not associated with a repl?
>
> We have no reliable way to do this. The unreliable (kinda okay with
> SERVE-EVENT, probably suicide with threads) is in .emacs:
>
>   (setq slime-global-debugger-hook t)
>
> That way *DEBUGGER-HOOK* will be globally bound to contact Emacs,
> always using the same connection, come-what-may. My previous attempt
> at multiprocessing support just added locks to this so that only one
> thread would talk to Emacs at a time.
>
> But hopefully the multiple-session support will fix all this. Today it
> would be possible for Emacs to connect to multiple Swank servers each
> run by a different thread in the same Lisp. The trick is just to hack
> in support for creating these extra connections on-demand (e.g. when a
> thread hits the debugger). I was planning to hack that up on the
> weekend if I get time, but you're welcome to beat me to it too :-)
>
> Cheers,
> Luke
>
>
>
> _______________________________________________
> slime-devel site list
> slime-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/slime-devel





More information about the slime-devel mailing list