[slime-devel] Re: *read-default-float-format* with C-c C-k, , load-system, etc.
Dirk Gerrits
dirk at dirkgerrits.com
Sun Jan 2 22:08:23 UTC 2005
Christophe Rhodes <csr21 at cam.ac.uk> writes:
> I've slightly lost track of how slime works multithreadedly -- does it
> spawn a new thread for each evaluation, or does it farm them off to a
> worker thread?
I'm not familiar with SLIME's internals, but I've done some tests with
SB-THREAD:CURRENT-THREAD-ID. In my package.lisp file, I've got the
following:
(eval-when (:compile-toplevel :load-toplevel :execute)
(with-open-file (stream "thread-id.txt" :direction :output
:if-exists :append)
(print (sb-thread:current-thread-id) stream))
;; Use long-floats instead of single-floats by default.
(setq *read-default-float-format* 'long-float))
When I do a ,load-system of my ASDF system from the REPL, the processing
of this file generated thread-ids:
23673
23710
23710
The REPL has thread-id 23710 as well. So I guess COMPILE-OP is done in
a seperate thread but LOAD-OP is done in the REPL thread? Using the
*inferior-lisp* buffer's REPL reports 23706, by the way.
Putting the point after (sb-thread:current-thread-id) in the
package.lisp file and then pressing C-x C-e produces a different
thread-id each time I do it: 23761, 23762, 23763, ...
Similarly for C-M-x.
So it seems that these commands spawn a new thread each time. These
threads don't seem to be children of the REPL's thread, since
*read-default-float-format* evaluates to LONG-FLOAT in the REPL, but
doing a C-x C-e on *read-default-float-format* in package.lisp yields
SINGLE-FLOAT.
When I do a (setq *read-default-float-format* 'long-float) in the
*inferior-lisp* buffer, the above situation doesn't change, so the
spawned threads don't seem to be children of *inferior-lisp*'s thread
either.
Is there perhaps any way in SBCL for me to examine the parent/child
relations between threads in order to give you more information?
> Given your description, I would suggest trying to set
> *read-default-float-format* in the slime thread which does some work:
> try first setting it in the *inferior-lisp* buffer. If that's not the
> right thread to set it in, and you can find the right one but can't
> set the variable in it, shout and I'll make a (setf
> (symbol-value-in-thread ...) ...) function available.
Something like this?
#+:sb-thread
(when (find-package :swank-loader)
(setf (sb-thread::symbol-value-in-thread *read-default-float-format*
(the-right-thread))
'long-float))
Sounds reasonable, but I haven't found the right thread yet. Any SLIME
developers who can help?
Thanks for the help so far.
Kind regards,
Dirk Gerrits
More information about the slime-devel
mailing list