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