[slime-cvs] CVS slime

CVS User trittweiler trittweiler at common-lisp.net
Wed Mar 10 11:30:22 UTC 2010


Update of /project/slime/cvsroot/slime
In directory cl-net:/tmp/cvs-serv7419

Modified Files:
	ChangeLog swank-ecl.lisp 
Log Message:
	* swank-ecl.lisp (*original-sigint-handler*)
	(install-sigint-handler): Deleted; we directly implement
	call-with-user-break-handler instead.
	(call-with-user-break-handler): New. Correctly interrupt main
	thread instead of newly spawned handle-signal thread on SIGINT.
	(make-interrupt-handler): New helper.


--- /project/slime/cvsroot/slime/ChangeLog	2010/03/10 00:02:53	1.2032
+++ /project/slime/cvsroot/slime/ChangeLog	2010/03/10 11:30:22	1.2033
@@ -1,3 +1,12 @@
+2010-03-10  Tobias C. Rittweiler <tcr at freebits.de>
+
+	* swank-ecl.lisp (*original-sigint-handler*)
+	(install-sigint-handler): Deleted; we directly implement
+	call-with-user-break-handler instead.
+	(call-with-user-break-handler): New. Correctly interrupt main
+	thread instead of newly spawned handle-signal thread on SIGINT.
+	(make-interrupt-handler): New helper.
+
 2010-03-09  Stas Boukarev  <stassats at gmail.com>
 
 	* swank-ccl.lisp (emacs-inspect function): Print closed over variables
@@ -62,7 +71,7 @@
 	it boils down to SIGNAL-INTERRUPT which uses USE-THREADS-P which
 	needs a connection.
 	(install-fd-handler): Adapted accordingly.
-	(simple-serve-event): Adapted accordingly. Additionally, remove
+	(simple-serve-requests): Adapted accordingly. Additionally, remove
 	superfluous WITH-SWANK-PROTOCOL-HANDLER as that's established by
 	WITH-CONNECTION already.
 	(simple-repl): Show "abort inferior lisp" restart only if not a
--- /project/slime/cvsroot/slime/swank-ecl.lisp	2010/03/07 07:40:46	1.61
+++ /project/slime/cvsroot/slime/swank-ecl.lisp	2010/03/10 11:30:22	1.62
@@ -124,19 +124,33 @@
 
 ;;;; Unix Integration
 
-(defvar *original-sigint-handler* #'si:terminal-interrupt)
+;;; If ECL is built with thread support, it'll spawn a helper thread
+;;; executing the SIGINT handler. We do not want to BREAK into that
+;;; helper but into the main thread, though. This is coupled with the
+;;; current choice of NIL as communication-style in so far as ECL's
+;;; main-thread is also the Slime's REPL thread.
 
-(defimplementation install-sigint-handler (handler)
-  (declare (function handler))
-  (let ((old-handler (symbol-function 'si:terminal-interrupt)))
+(defimplementation call-with-user-break-handler (real-handler function)
+  (let ((old-handler #'si:terminal-interrupt))
     (setf (symbol-function 'si:terminal-interrupt)
-          (if (eq handler *original-sigint-handler*)
-              handler
-              (lambda (&rest args)
-                (declare (ignore args))
-                (funcall handler)
-                (continue))))
-    old-handler))
+          (make-interrupt-handler real-handler))
+    (unwind-protect (funcall function)
+      (setf (symbol-function 'si:terminal-interrupt) old-handler))))
+
+#+threads
+(defun make-interrupt-handler (real-handler)
+  (let ((main-thread (find 'si:top-level (mp:all-processes)
+                           :key #'mp:process-name)))
+    #'(lambda (&rest args)
+        (declare (ignore args))
+        (mp:interrupt-process main-thread real-handler))))
+
+#-threads
+(defun make-interrupt-handler (real-handler)
+  #'(lambda (&rest args)
+      (declare (ignore args))
+      (funcall real-handler)))
+
 
 (defimplementation getpid ()
   (si:getpid))





More information about the slime-cvs mailing list