I am currently playing with sb-thread API, provided by SBCL, wondering what happens if an error is thrown inside a started thread and how to ensure that only that process is affected (and dies), and no other process is, as apparently the debugger will be entered even though not the main thread throws an error.
* (handler-case
(sb-thread:join-thread (sb-thread:make-thread #'(lambda()
(error 'simple-error))))
(sb-thread:join-thread-error (err)
(sb-thread:thread-error-thread err)
(FORMAT t "allemeineentchen~%")))
(A SIMPLE-ERROR was caught when trying to print *DEBUG-CONDITION* when entering
the debugger. Printing was aborted and the SIMPLE-ERROR was stored in
SB-DEBUG::*NESTED-DEBUG-CONDITION*.)
;after this sbcl just yields until str-c enters the debugger
My suggestion would be to make each thread function body starting with an (handler-case (body) (error (err) err)
but this seems awfully non-standard/malpractice and only works with threads whose function body are created by me, and I am not sure that this will, in every case, prevent entering the debugger.
Is there some guideline/(unofficial)standard concerning this topic?