[armedbear-devel] Patch to add multi-threading to ABCL SLIME
evenson at panix.com
Thu Jul 2 09:00:12 UTC 2009
Don Cohen wrote:
> Mark Evenson writes:
> > Attached is a patch against SLIME CVS HEAD to implement multi-threading
> Is there some documentation about how to use multithreading in abcl?
No, unfortunately there isn't, and I've never totally convinced myself
from reading the code that the internals of ABCL are going to hold up
under heavy usage, which was part of my motivation to try this out.
The interfaces, such as they exist, can be seen in [LispThread.java],
all existing in the EXTERNAL package.
A quick transcription of the source code:
(MAKE-THREAD FUNCTION &key NAME)
Creates and runs a thread to evalulate FUNCTION setting the NAME.
Boolean predicate whether OBJECT is a thread.
Boolean predicate whether THREAD is alive.
Return name of THREAD.
Cause the invoking thread to sleep SECONDS which can be expressed as
a fraction, i.e. (sleep .1) would sleep for 100ms.
Apply FUNCTION to each of the threads created via MAKE-THREAD.
Mark THREAD as destroyed.
(INTERRUPT THREAD FUNCTION &rest ARGS)
Interrupt thread to apply function to args. Order of interrupts is
not guaranteed. Thread should resume processing after processing all
Sets an internal optimization for execution to BOOLEAN.
Of these functions, I am only sure that MAKE-THREAD and SLEEP work.
Setting the thread's name doesn't currently work, but I'll fix that with
patches when I get a chance. And add docstrings with the above content.
> I've never used slime but am looking at the doc now.
> What I was hoping to see but don't yet is how to debug a thread.
> In particular, I want to know how to
> - break a running thread (so it goes into the debugger)
> - connect an emacs buffer to the debugger ONLY in that thread
This is beyond my knowledge. From a quick browsing of the SLIME source
there is a thread browser with a DEBUG-NTH-THREAD function that looks
like a promising answer to your first question.
> If there is any current support for these things, even in some
> other lisp implementation, even in some emacs package other than
> slime, please send a link.
I would have said your best bet for multi-threading SLIME interaction is
probably [SBCL] on a supported multi-threading platform (I know that
Linux and OSX are supported), but I just tried the promising
SLIME-LIST-THREADS emacs function, returning a condition stating that
SWANK-BACKEND:ALL-THREADS isn't implemented.
You might try asking on the [SLIME mailing list]. Note that the
SLIME community is a very "hack it yourself" oriented group, as there
aren't releases per se.
"A screaming comes across the sky. It has happened before, but there
is nothing to compare to it now."
More information about the armedbear-devel