[slime-devel] :spawn clobbers *debug-hook*

Peter Seibel peter at javamonkey.com
Thu Oct 7 17:51:09 UTC 2004


So this seems not so nice. Currently in swank.lisp we have this function:

  (defun spawn-threads-for-connection (connection)
    (let* ((socket-io (connection.socket-io connection))
           (control-thread (spawn (lambda ()
                                    (setq *debugger-hook* nil)
                                    (dispatch-loop socket-io connection))
                                  :name "control-thread")))
      (setf (connection.control-thread connection) control-thread)
      (let ((reader-thread (spawn (lambda () 
                                    (setq *debugger-hook* nil)
                                    (read-loop control-thread socket-io
                                               connection))
                                  :name "reader-thread"))
            (repl-thread (spawn (lambda () (repl-loop connection))
                                :name "repl-thread")))
        (setf (connection.reader-thread connection) reader-thread)
        (setf (connection.repl-thread connection) repl-thread)
        connection)))

Consequently after .swank.lisp is loaded (in which I set *debug-hook*
to #'swank-debugger-hook) this function runs and clobbers the global
value. Threads spawned by AllegroServe seem to inherit their value
from the global value so they don't get swank-debugger-hook unless I
set it in *inferior-lisp*. Is there some reason this isn't a good
patch:

  Index: swank.lisp
  ===================================================================
  RCS file: /project/slime/cvsroot/slime/swank.lisp,v
  retrieving revision 1.248
  diff -u -r1.248 swank.lisp
  --- swank.lisp	6 Oct 2004 12:39:35 -0000	1.248
  +++ swank.lisp	7 Oct 2004 17:55:14 -0000
  @@ -507,14 +507,14 @@
   (defun spawn-threads-for-connection (connection)
     (let* ((socket-io (connection.socket-io connection))
            (control-thread (spawn (lambda ()
  -                                  (setq *debugger-hook* nil)
  -                                  (dispatch-loop socket-io connection))
  +                                  (let ((*debugger-hook* nil))
  +                                    (dispatch-loop socket-io connection)))
                                   :name "control-thread")))
       (setf (connection.control-thread connection) control-thread)
       (let ((reader-thread (spawn (lambda () 
  -                                  (setq *debugger-hook* nil)
  -                                  (read-loop control-thread socket-io
  -                                             connection))
  +                                  (let ((*debugger-hook* nil))
  +                                    (read-loop control-thread socket-io
  +                                               connection)))
                                   :name "reader-thread"))
             (repl-thread (spawn (lambda () (repl-loop connection))
                                 :name "repl-thread")))


-Peter

-- 
Peter Seibel                                      peter at javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp





More information about the slime-devel mailing list