X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fsignal.lisp;h=55eb7ca7398ffdc84e6c186d687ab774df8b5f36;hb=6ddaf294e5a7e3b1792ed1d9c342894c38538773;hp=a4c529878aba4eb1ff4de5f6298c0fd67e6e05b0;hpb=5a2b6553fbbbb62fa789350facd0d56bb136045f;p=sbcl.git diff --git a/src/code/signal.lisp b/src/code/signal.lisp index a4c5298..55eb7ca 100644 --- a/src/code/signal.lisp +++ b/src/code/signal.lisp @@ -45,18 +45,23 @@ "Execute BODY in a context impervious to interrupts." (let ((name (gensym "WITHOUT-INTERRUPTS-BODY-"))) `(flet ((,name () ,@body)) - (if *interrupts-enabled* - (unwind-protect - (let ((*interrupts-enabled* nil)) - (,name)) - ;; FIXME: Does it matter that an interrupt coming in here - ;; could be executed before any of the pending interrupts? - ;; Or do incoming interrupts have the good grace to check - ;; whether interrupts are pending before executing themselves - ;; immediately? - (when *interrupt-pending* - (receive-pending-interrupt))) - (,name))))) + (if *interrupts-enabled* + (unwind-protect + (let ((*interrupts-enabled* nil)) + (,name)) + ;; If we were interrupted in the protected section, then + ;; the interrupts are still blocked and it remains so + ;; until the pending interrupt is handled. + ;; + ;; If we were not interrupted in the protected section, + ;; but here, then even if the interrupt handler enters + ;; another WITHOUT-INTERRUPTS, the pending interrupt will + ;; be handled immediately upon exit from said + ;; WITHOUT-INTERRUPTS, so it is as if nothing has + ;; happened. + (when *interrupt-pending* + (receive-pending-interrupt))) + (,name))))) (sb!xc:defmacro with-interrupts (&body body) #!+sb-doc @@ -65,8 +70,8 @@ (let ((name (gensym))) `(flet ((,name () ,@body)) (if *interrupts-enabled* - (,name) - (let ((*interrupts-enabled* t)) - (when *interrupt-pending* - (receive-pending-interrupt)) - (,name)))))) + (,name) + (let ((*interrupts-enabled* t)) + (when *interrupt-pending* + (receive-pending-interrupt)) + (,name))))))