X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftoplevel.lisp;h=714fc4a72a7844b0d58e946370839fb966065867;hb=8a33054f6541596c61b091e2b77118deda1511e2;hp=9fa8189305836dbe78e5020ae1855fdcd2c774f6;hpb=f0da2f63aa0b4e6d4dbf884854a4bf2dfdd01fc0;p=sbcl.git diff --git a/src/code/toplevel.lisp b/src/code/toplevel.lisp index 9fa8189..714fc4a 100644 --- a/src/code/toplevel.lisp +++ b/src/code/toplevel.lisp @@ -107,13 +107,18 @@ means to wait indefinitely.") (defun %exit () ;; If anything goes wrong, we will exit immediately and forcibly. (handler-bind ((serious-condition *exit-error-handler*)) - (let (ok) - (unwind-protect - (progn - (flush-standard-output-streams) - (sb!thread::%exit-other-threads) - (setf ok t)) - (os-exit *exit-in-process* :abort (not ok)))))) + (let ((ok nil) + (code *exit-in-process*)) + (if (consp code) + ;; Another thread called EXIT, and passed the buck to us -- only + ;; final call left to do. + (os-exit (car code) :abort nil) + (unwind-protect + (progn + (flush-standard-output-streams) + (sb!thread::%exit-other-threads) + (setf ok t)) + (os-exit code :abort (not ok))))))) ;;;; working with *CURRENT-ERROR-DEPTH* and *MAXIMUM-ERROR-DEPTH*