Simplify and extend using the knots exception with stack

This commit is contained in:
Christopher Baines 2025-02-27 12:08:41 +00:00
parent d8bc09755e
commit ed4113af51
3 changed files with 38 additions and 29 deletions

View file

@ -253,18 +253,20 @@ arguments of the thread pool procedure."
proc)
(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))
(match (fluid-ref %stacks)
((stack-tag . prompt-tag)
(let ((stack (make-stack #t
0 prompt-tag
0 (and prompt-tag 1))))
(raise-exception
(make-exception
exn
(make-knots-exception stack)))))))
(lambda ()
(call-with-values
(lambda ()
(start-stack
'thread-pool
#t
(apply proc args)))
(lambda vals
(cons (/ (- (get-internal-real-time)