[slime-cvs] CVS slime

CVS User heller heller at common-lisp.net
Wed Dec 7 22:04:37 UTC 2011


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

Modified Files:
	ChangeLog swank.lisp 
Log Message:
* swank.lisp (*slime-interrupts-enabled*): Describe the idea
behind the interrupt handlig code a bit.

--- /project/slime/cvsroot/slime/ChangeLog	2011/12/07 21:06:30	1.2279
+++ /project/slime/cvsroot/slime/ChangeLog	2011/12/07 22:04:37	1.2280
@@ -1,5 +1,10 @@
 2011-12-07  Helmut Eller  <heller at common-lisp.net>
 
+	* swank.lisp (*slime-interrupts-enabled*): Describe the idea
+	behind the interrupt handlig code a bit.
+
+2011-12-07  Helmut Eller  <heller at common-lisp.net>
+
 	Make *event-queue* and *events-enqueued* slots of the connection
 	struct.
 
--- /project/slime/cvsroot/slime/swank.lisp	2011/12/07 21:06:30	1.775
+++ /project/slime/cvsroot/slime/swank.lisp	2011/12/07 22:04:37	1.776
@@ -458,7 +458,28 @@
 
 ;;;; Interrupt handling 
 
-;; FIXME: should document how this is supposed to work.
+;; Usually we'd like to enter the debugger when an interrupt happens.
+;; But for some operations, in particular send&receive, it's crucial
+;; that those are not interrupted when the mailbox is in an
+;; inconsistent/locked state. Obviously, if send&receive don't work we
+;; can't communicate and the debugger will not work.  To solve that
+;; problem, we try to handle interrupts only at certain safe-points.
+;;
+;; Whenever an interrupt happens we call the function
+;; INVOKE-OR-QUEUE-INTERRUPT.  Usually this simply invokes the
+;; debugger, but if interrupts are disabled the interrupt is put in a
+;; queue for later processing.  At safe-points, we call
+;; CHECK-SLIME-INTERRUPTS which looks at the queue and invokes the
+;; debugger if needed.
+;;
+;; The queue for interrupts is stored in a thread local variable.
+;; WITH-CONNECTION sets it up.  WITH-SLIME-INTERRUPTS allows
+;; interrupts, i.e. the debugger is entered immediately.  When we call
+;; "user code" or non-problematic code we allow interrupts.  When
+;; inside WITHOUT-SLIME-INTERRUPTS, interrupts are queued.  When we
+;; switch from "user code" to more delicate operations we need to
+;; disable interrupts.  In particular, interrupts should be disabled
+;; for SEND and RECEIVE-IF.
 
 ;; If true execute interrupts, otherwise queue them.
 ;; Note: `with-connection' binds *pending-slime-interrupts*.
@@ -508,7 +529,7 @@
      . ,body))
 
 ;; Thread local variable used for flow-control.
-;; It's bound by with-connection.
+;; It's bound by `with-connection'.
 (defvar *send-counter*)
 
 (defmacro with-connection ((connection) &body body)





More information about the slime-cvs mailing list