[slime-cvs] CVS slime

CVS User sboukarev sboukarev at common-lisp.net
Fri Apr 6 20:04:34 UTC 2012


Update of /project/slime/cvsroot/slime
In directory tiger.common-lisp.net:/tmp/cvs-serv2862

Modified Files:
	ChangeLog swank.lisp 
Log Message:
* swank.lisp (interrupt-worker-thread): Interrupt the REPL thread if
there are no threads found. Send Emacs an error message if no
threads are found at all.


--- /project/slime/cvsroot/slime/ChangeLog	2012/03/30 09:45:00	1.2308
+++ /project/slime/cvsroot/slime/ChangeLog	2012/04/06 20:04:34	1.2309
@@ -1,3 +1,9 @@
+2012-04-06  Stas Boukarev  <stassats at gmail.com>
+
+	* swank.lisp (interrupt-worker-thread): Interrupt the REPL thread if
+	there are no threads found. Send Emacs an error message if no
+	threads are found at all.
+
 2012-03-30  Nikodemus Siivola  <nikodemus at random-state.net>
 
 	* swank-sbcl.lisp (lisp-source-location): When processing a STEP-FORM-CONDITION,
--- /project/slime/cvsroot/slime/swank.lisp	2012/03/06 20:55:07	1.783
+++ /project/slime/cvsroot/slime/swank.lisp	2012/04/06 20:04:34	1.784
@@ -997,27 +997,29 @@
   (etypecase id
     ((member t)
      (etypecase connection
-       (multithreaded-connection (car (mconn.active-threads connection)))
+       (multithreaded-connection (or (car (mconn.active-threads connection))
+                                     (find-repl-thread connection)))
        (singlethreaded-connection (current-thread))))
     ((member :repl-thread) 
      (find-repl-thread connection))
-    (fixnum 
+    (fixnum
      (find-thread id))))
 
 (defun interrupt-worker-thread (connection id)
-  (let ((thread (or (find-worker-thread connection id)
-                    ;; FIXME: to something better here
-                    (spawn (lambda ()) :name "ephemeral"))))
+  (let ((thread (find-worker-thread connection id)))
     (log-event "interrupt-worker-thread: ~a ~a~%" id thread)
-    (assert thread)
-    (etypecase connection
-      (multithreaded-connection
-       (interrupt-thread thread
-                         (lambda ()
-                           ;; safely interrupt THREAD
-                           (invoke-or-queue-interrupt #'simple-break))))
-      (singlethreaded-connection
-       (simple-break)))))
+    (if thread
+        (etypecase connection
+          (multithreaded-connection
+           (interrupt-thread thread
+                             (lambda ()
+                               ;; safely interrupt THREAD
+                               (invoke-or-queue-interrupt #'simple-break))))
+          (singlethreaded-connection
+           (simple-break)))
+        (let ((*send-counter* 0)) ;; shouldn't be necessary, but it is
+          (send-to-emacs (list :debug-condition (current-thread-id)
+                               (format nil "Thread with id ~a not found" id)))))))
 
 (defun thread-for-evaluation (connection id)
   "Find or create a thread to evaluate the next request."





More information about the slime-cvs mailing list