From db6956e5aa06c80279cc53c329c66200aa5f2845 Mon Sep 17 00:00:00 2001 From: Yorick Hardy Date: Fri, 3 Jan 2025 00:48:45 +0200 Subject: [PATCH] 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. --- srfi/18.sld | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/srfi/18.sld b/srfi/18.sld index a7ee9a3b..11d46a28 100644 --- a/srfi/18.sld +++ b/srfi/18.sld @@ -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?