Fix updating the thread-proc-vector in thread pools

This commit is contained in:
Christopher Baines 2025-11-17 11:19:01 +00:00
parent a13098494d
commit 2446078657

View file

@ -269,7 +269,7 @@ from there, or #f if that would be an empty string."
(sleep 1)
(destructor/safe args)))))
(define (process channel args)
(define (process thread-index channel args)
(let loop ()
(match (get-message channel)
('destroy #f)
@ -292,6 +292,9 @@ from there, or #f if that would be an empty string."
internal-time-units-per-second)
exn))
(lambda ()
(vector-set! thread-proc-vector
thread-index
proc)
(with-exception-handler
(lambda (exn)
(let ((stack
@ -319,6 +322,10 @@ from there, or #f if that would be an empty string."
vals))))))
#:unwind? #t)))
(vector-set! thread-proc-vector
thread-index
#f)
(put-message reply
response)
@ -358,7 +365,7 @@ from there, or #f if that would be an empty string."
"knots: thread-pool: internal exception: ~A\n" exn))
(lambda ()
(parameterize ((param args))
(process channel args)))
(process index channel args)))
#:unwind? #t)))
(when thread-destructor