srfi-18: do a minor gc when terminating a thread

This ensures that any objects which are part of the
thread context are transferred to the heap.

Partial work towards addressing issue #534.
This commit is contained in:
Yorick Hardy 2025-01-03 00:48:45 +02:00
parent dd2b5c1174
commit db6956e5aa

View file

@ -152,7 +152,9 @@
(define (thread-terminate! t)
(cond
((and (thread? t) (Cyc-opaque? (vector-ref t 2)))
(%thread-terminate! (vector-ref t 2)))
(begin
(Cyc-minor-gc)
(%thread-terminate! (vector-ref t 2))))
(else
#f))) ;; TODO: raise an error instead?
@ -176,6 +178,7 @@
(cond
((and (thread? t) (Cyc-opaque? (vector-ref t 2)))
(%thread-join! (vector-ref t 2))
(Cyc-minor-gc)
(vector-ref t 7))
(else
#f))) ;; TODO: raise an error instead?