From fddc5c40f4b33c85140e4511f64771afa0b270e7 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Fri, 11 Dec 2015 10:28:50 -0700 Subject: [PATCH] Note last-statistic early in signal-gc-events. The signaled thread events may run whenever, perhaps after last-statistic is changed. Ensure all the thread events get the same statistic -- the last-statistic when the events were sent. --- src/runtime/gcnote.scm | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/runtime/gcnote.scm b/src/runtime/gcnote.scm index 30c1dd44a..9053466a5 100644 --- a/src/runtime/gcnote.scm +++ b/src/runtime/gcnote.scm @@ -108,18 +108,19 @@ USA. (and entry (weak-cdr entry)))) (define (signal-gc-events) - (for-each - (lambda (entry) - (let ((thread (weak-car entry)) - (event (weak-cdr entry))) - (if (and thread event) - (signal-thread-event - thread - (named-lambda (gc-event) - (abort-if-heap-low (gc-statistic/heap-left last-statistic)) - (event last-statistic)) - #t)))) - gc-events)) + (let ((statistic last-statistic)) + (for-each + (lambda (entry) + (let ((thread (weak-car entry)) + (event (weak-cdr entry))) + (if (and thread event) + (signal-thread-event + thread + (named-lambda (gc-event) + (abort-if-heap-low (gc-statistic/heap-left statistic)) + (event statistic)) + #t)))) + gc-events))) (define (weak-assq obj alist) (let loop ((alist alist)) -- 2.25.1