X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftoplevel.lisp;h=54819e15b0223d83ada4a89b01da02118a636cca;hb=3cd426802c5f093d8d07042b9f180e38b8631c0b;hp=9fa8189305836dbe78e5020ae1855fdcd2c774f6;hpb=f0da2f63aa0b4e6d4dbf884854a4bf2dfdd01fc0;p=sbcl.git diff --git a/src/code/toplevel.lisp b/src/code/toplevel.lisp index 9fa8189..54819e1 100644 --- a/src/code/toplevel.lisp +++ b/src/code/toplevel.lisp @@ -30,6 +30,7 @@ *allow-with-interrupts* *interrupts-enabled* *interrupt-pending* + #!+sb-thruption *thruption-pending* *type-system-initialized*)) (defvar *cold-init-complete-p*) @@ -107,13 +108,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* @@ -125,7 +131,7 @@ means to wait indefinitely.") (let ((*current-error-depth* (1+ *current-error-depth*))) (/show0 "in INFINITE-ERROR-PROTECT, incremented error depth") ;; arbitrary truncation - #!+sb-show (sb!debug:backtrace 8) + #!+sb-show (sb!debug:print-backtrace :count 8) ,@forms))) ;;; a helper function for INFINITE-ERROR-PROTECT @@ -192,11 +198,12 @@ any non-negative real number." (when (or (not (realp seconds)) (minusp seconds)) (error 'simple-type-error - :format-control "invalid argument to SLEEP: ~S" + :format-control "Invalid argument to SLEEP: ~S, ~ + should be a non-negative real." :format-arguments (list seconds) :datum seconds :expected-type '(real 0))) - #!-win32 + #!-(and win32 (not sb-thread)) (multiple-value-bind (sec nsec) (if (integerp seconds) (values seconds 0) @@ -210,7 +217,7 @@ any non-negative real number." do (decf sec (expt 10 8)) (sb!unix:nanosleep (expt 10 8) 0)) (sb!unix:nanosleep sec nsec)) - #!+win32 + #!+(and win32 (not sb-thread)) (sb!win32:millisleep (truncate (* seconds 1000))) nil)