From: Guillermo J. Rozas <edu/mit/csail/zurich/gjr>
Date: Fri, 25 Jun 1993 21:09:08 +0000 (+0000)
Subject: Change gc-daemons and secondary-gc-daemons into queues so that the
X-Git-Tag: 20090517-FFI~8274
X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=ba306113e499798f47ea439dcdd3e9b087397ce1;p=mit-scheme.git

Change gc-daemons and secondary-gc-daemons into queues so that the
daemons are invoked in the order in which they are "declared".
---

diff --git a/v7/src/runtime/gcdemn.scm b/v7/src/runtime/gcdemn.scm
index 6d62f2ab3..96271a8e0 100644
--- a/v7/src/runtime/gcdemn.scm
+++ b/v7/src/runtime/gcdemn.scm
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/gcdemn.scm,v 14.4 1991/12/10 23:24:16 cph Exp $
+$Id: gcdemn.scm,v 14.5 1993/06/25 21:09:08 gjr Exp $
 
-Copyright (c) 1988-91 Massachusetts Institute of Technology
+Copyright (c) 1988-1993 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -38,8 +38,8 @@ MIT in each case. |#
 (declare (usual-integrations))
 
 (define (initialize-package!)
-  (set! gc-daemons '())
-  (set! secondary-gc-daemons '())
+  (set! gc-daemons (make-queue))
+  (set! secondary-gc-daemons (make-queue))
   (let ((fixed-objects (get-fixed-objects-vector)))
     (vector-set! fixed-objects #x0B trigger-gc-daemons)
     ((ucode-primitive set-fixed-objects-vector!) fixed-objects)))
@@ -47,23 +47,22 @@ MIT in each case. |#
 (define gc-daemons)
 (define secondary-gc-daemons)
 
+(define (invoke-thunk thunk)
+  (thunk))
+
 (define (trigger-gc-daemons)
-  (do ((daemons gc-daemons (cdr daemons)))
-      ((null? daemons))
-    ((car daemons))))
+  (for-each invoke-thunk
+	    (queue->list/unsafe gc-daemons)))
 
 (define (trigger-secondary-gc-daemons!)
-  (do ((daemons secondary-gc-daemons (cdr daemons)))
-      ((null? daemons))
-    ((car daemons))))
+  (for-each invoke-thunk
+	    (queue->list/unsafe secondary-gc-daemons)))
 
 (define (add-gc-daemon! daemon)
-  (set! gc-daemons (cons daemon gc-daemons))
-  unspecific)
+  (enqueue! gc-daemons daemon))
 
 (define (add-secondary-gc-daemon! daemon)
-  (set! secondary-gc-daemons (cons daemon secondary-gc-daemons))
-  unspecific)
+  (enqueue! secondary-gc-daemons daemon))
 
 (define (gc-clean #!optional threshold)
   (let ((threshold