Improve thread pool exception logging

This commit is contained in:
Christopher Baines 2025-02-26 10:07:54 +00:00
parent 13f1118576
commit f549bee282

View file

@ -251,7 +251,15 @@ arguments of the thread pool procedure."
(vector-set! thread-proc-vector
thread-index
proc)
(with-throw-handler #t
(with-exception-handler
(lambda (exn)
(when (log-exception? exn)
(simple-format
(current-error-port)
"thread-pool: exception running ~A\n" proc)
(print-backtrace-and-exception/knots
exn))
(raise-exception exn))
(lambda ()
(call-with-values
(lambda ()
@ -262,16 +270,7 @@ arguments of the thread pool procedure."
(cons (/ (- (get-internal-real-time)
start-time)
internal-time-units-per-second)
vals))))
(lambda args
(when (match args
(('%exception exn)
(log-exception? exn))
(_ #t))
(simple-format
(current-error-port)
"thread-pool: exception: ~A\n" args)
(backtrace)))))
vals))))))
#:unwind? #t)))
(put-message reply
response)