From e2355f760c61f13a4b81398d11844a4b308bf92d Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Thu, 15 Nov 2018 19:14:56 -0700 Subject: [PATCH] gcnote: When heap runs low, abort just the current/console thread. --- src/runtime/gcnote.scm | 13 +++++-------- src/runtime/runtime.pkg | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/runtime/gcnote.scm b/src/runtime/gcnote.scm index de50abff1..d77fe6980 100644 --- a/src/runtime/gcnote.scm +++ b/src/runtime/gcnote.scm @@ -120,14 +120,11 @@ USA. (without-interrupts (lambda () (if (< (gc-statistic/heap-left statistic) 4096) - (begin - (for-each - (lambda (entry) - (signal-event (weak-car entry) abort-heap-low)) - gc-events) - (let ((thread (console-thread))) - (if (and thread (not (weak-assq thread gc-events))) - (signal-event thread abort-heap-low)))) + (if first-running-thread + (signal-event first-running-thread abort-heap-low) + (let ((thread (console-thread))) + (if thread + (signal-event thread abort-heap-low)))) (for-each (lambda (entry) (let ((thread (weak-car entry)) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 8af0e7e7e..0a8d87041 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -2283,6 +2283,7 @@ USA. (export (runtime thread) %deregister-gc-event) (import (runtime thread) + first-running-thread %maybe-toggle-thread-timer %signal-thread-event) (initialization (initialize-package!))) -- 2.25.1