Call init-hooks before starting finalizer

See https://groups.google.com/g/sbcl-devel/c/U98XUqdI5lY/m/-sQ7VQcmBAAJ
This commit is contained in:
Douglas Katzman 2021-08-12 19:30:28 -04:00
parent 00e576f2f9
commit 3558c49426
2 changed files with 35 additions and 2 deletions

View file

@ -341,8 +341,8 @@ process to continue normally."
;; re-disable ldb again.
(when (eq *invoke-debugger-hook* 'sb-debug::debugger-disabled-hook)
(sb-debug::disable-debugger))
#+sb-thread (finalizer-thread-start)
(call-hooks "initialization" *init-hooks*))
(call-hooks "initialization" *init-hooks*)
#+sb-thread (finalizer-thread-start))
;;;; some support for any hapless wretches who end up debugging cold
;;;; init code

33
tests/init-hooks.test.sh Normal file
View file

@ -0,0 +1,33 @@
#!/bin/sh
# This software is part of the SBCL system. See the README file for
# more information.
#
# While most of SBCL is derived from the CMU CL system, the test
# files (like this one) were written from scratch after the fork
# from CMU CL.
#
# This software is in the public domain and is provided with
# absolutely no warranty. See the COPYING and CREDITS files for
# more information.
. ./subr.sh
use_test_subdirectory
tmpcore="init-hook-test.core"
run_sbcl <<EOF
(push 'check-no-threads sb-ext:*init-hooks*)
(defun check-no-threads ()
(sb-sys:os-exit (if (sb-thread::thread-p sb-impl::*finalizer-thread*) 1 0)))
(save-lisp-and-die "$tmpcore")
EOF
if [ $? -ne 0 ]; then
echo "failure saving core"
exit 1
fi
run_sbcl_with_core "$tmpcore" --noinform --disable-debugger
check_status_maybe_lose "init-hooks execution order" $? 0 "(passed)"
exit $EXIT_TEST_WIN