Add new event-receiver, `event:before-exit', which is invoked before
authorChris Hanson <org/chris-hanson/cph>
Fri, 9 Jun 1989 16:51:44 +0000 (16:51 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 9 Jun 1989 16:51:44 +0000 (16:51 +0000)
Scheme is killed and before a disk-restore is performed.  This allows
cleaning up of any state, such as open files, that relates the runtime
system to the external world.

v7/src/runtime/gdatab.scm
v7/src/runtime/global.scm
v7/src/runtime/io.scm
v7/src/runtime/runtime.pkg
v7/src/runtime/savres.scm
v7/src/runtime/version.scm
v8/src/runtime/global.scm
v8/src/runtime/runtime.pkg

index 976dee5b6f2fa0e6fdb8c10d3a1b5718006cef8c..d3df67da7937866e3adf1207e65545cff36b2659 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/gdatab.scm,v 14.3 1988/06/16 06:27:40 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/gdatab.scm,v 14.4 1989/06/09 16:51:21 cph Rel $
 
-Copyright (c) 1988 Massachusetts Institute of Technology
+Copyright (c) 1988, 1989 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -40,12 +40,14 @@ MIT in each case. |#
 (define (initialize-package!)
   (set! event:after-restore (make-event-distributor))
   (set! event:after-restart (make-event-distributor))
+  (set! event:before-exit (make-event-distributor))
   (set! tagged-pair-methods (make-1d-table))
   (set! tagged-vector-methods (make-1d-table))
   (set! named-structure-descriptions (make-1d-table)))
 
 (define event:after-restore)
 (define event:after-restart)
+(define event:before-exit)
 (define tagged-pair-methods)
 (define tagged-vector-methods)
 (define named-structure-descriptions)
index 3852afcf91c93308bdbd55dad856437c4491ec68..cc9e6a34c2abfb1735bc9a11a7c4412f2a29b9ae 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/global.scm,v 14.8 1989/05/21 17:14:29 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/global.scm,v 14.9 1989/06/09 16:51:27 cph Rel $
 
-Copyright (c) 1988 Massachusetts Institute of Technology
+Copyright (c) 1988, 1989 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -172,7 +172,7 @@ MIT in each case. |#
   (if (prompt-for-confirmation "Kill Scheme? ")      (%exit)))
 
 (define (%exit)
-  (close-all-open-files)
+  (event-distributor/invoke! event:before-exit)
   ((ucode-primitive exit)))
 
 (define (quit)
index 96d45399d91a4922c7a550311705f0ca4e5fa915..7e15267eaa91a0cc637ecdf8b3715da7d9bb6ecc 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/io.scm,v 14.1 1988/06/13 11:46:32 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/io.scm,v 14.2 1989/06/09 16:51:31 cph Rel $
 
-Copyright (c) 1988 Massachusetts Institute of Technology
+Copyright (c) 1988, 1989 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -45,7 +45,8 @@ MIT in each case. |#
   (set! open-files-list (list 'OPEN-FILES-LIST))
   (set! traversing? false)
   (add-gc-daemon! close-lost-open-files-daemon)
-  (add-event-receiver! event:after-restore primitive-io/reset!))
+  (add-event-receiver! event:after-restore primitive-io/reset!)
+  (add-event-receiver! event:before-exit close-all-open-files))
 
 (define-integrable (make-physical-channel descriptor channel direction)
   (hunk3-cons descriptor channel direction))
index e525dc7a29f1ba3281efc92fc4293e055805a2d1..253e355878cbae9dd5f7a080cb093b9d490f9835 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/runtime.pkg,v 14.38 1989/06/06 22:42:36 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/runtime.pkg,v 14.39 1989/06/09 16:51:34 cph Exp $
 
 Copyright (c) 1988, 1989 Massachusetts Institute of Technology
 
@@ -596,6 +596,7 @@ MIT in each case. |#
          add-unparser-special-pair!
          event:after-restart
          event:after-restore
+         event:before-exit
          named-structure/get-tag-description
          named-structure/set-tag-description!
          unparse-with-brackets
index 0cec04b1841aee08ed2652550c8490e3a2a233de..b67de4ee5bd326a29948d6856ccdc34d11798e9c 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/savres.scm,v 14.8 1989/03/14 02:16:13 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/savres.scm,v 14.9 1989/06/09 16:51:40 cph Rel $
 
 Copyright (c) 1988, 1989 Massachusetts Institute of Technology
 
@@ -123,7 +123,7 @@ MIT in each case. |#
       (set! filename
            (or ((ucode-primitive reload-band-name))
                (error "DISK-RESTORE: No default band name available"))))
-  (close-all-open-files)
+  (event-distributor/invoke! event:before-exit)
   ((ucode-primitive load-band) (canonicalize-input-filename filename)))\f
 (define world-identification "Scheme")
 (define time-world-saved)
index 1213dab582407cbf1582f596b02dfa897d0787cc..dcdb1164b14047483a4da6824f33c1ab51c52ba2 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/version.scm,v 14.44 1989/06/06 22:43:13 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/runtime/version.scm,v 14.45 1989/06/09 16:51:44 cph Exp $
 
 Copyright (c) 1988, 1989 Massachusetts Institute of Technology
 
@@ -45,7 +45,7 @@ MIT in each case. |#
                     '()))
   (add-system! microcode-system)
   (add-event-receiver! event:after-restore snarf-microcode-version!)
-  (add-identification! "Runtime" 14 44))
+  (add-identification! "Runtime" 14 45))
 
 (define microcode-system)
 
index 5a66f7b9a00e8a3086e38030ea137edfbbf8f1db..339f848a936d8e79ef6148331161317799d19e62 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/runtime/global.scm,v 14.8 1989/05/21 17:14:29 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/runtime/global.scm,v 14.9 1989/06/09 16:51:27 cph Rel $
 
-Copyright (c) 1988 Massachusetts Institute of Technology
+Copyright (c) 1988, 1989 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -172,7 +172,7 @@ MIT in each case. |#
   (if (prompt-for-confirmation "Kill Scheme? ")      (%exit)))
 
 (define (%exit)
-  (close-all-open-files)
+  (event-distributor/invoke! event:before-exit)
   ((ucode-primitive exit)))
 
 (define (quit)
index 23f7290b35c816d728c209a0850fb0a0bb4cca2e..674f2c456b0f89442b0a7e478aaba316d09edc4c 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/runtime/runtime.pkg,v 14.38 1989/06/06 22:42:36 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/runtime/runtime.pkg,v 14.39 1989/06/09 16:51:34 cph Exp $
 
 Copyright (c) 1988, 1989 Massachusetts Institute of Technology
 
@@ -596,6 +596,7 @@ MIT in each case. |#
          add-unparser-special-pair!
          event:after-restart
          event:after-restore
+         event:before-exit
          named-structure/get-tag-description
          named-structure/set-tag-description!
          unparse-with-brackets