io: correct custodian assumption

A custodian doesn't provide any order on shutting down the objects
that it manages (I was confused about some past experiments), so
avoid that assumption.
This commit is contained in:
Matthew Flatt 2019-04-29 16:19:35 -06:00
parent b3b240ebc7
commit dd22b8b599

View File

@ -13,15 +13,13 @@
(define (make-ltps)
(define ltps (rktio_ltps_open rktio))
(unless (rktio-error? ltps)
;; Rely on module ordering to ensure that this
;; custodian registration precedes any port (or other)
;; registrations that will need to be removed before
;; the ltps is closed
(unsafe-custodian-register (current-custodian)
ltps
;; in atomic mode
(lambda (ltps)
(rktio_ltps_close rktio ltps))
(rktio_ltps_remove_all rktio ltps)
(rktio_ltps_close rktio ltps)
(shared-ltps-reset!))
#f
#f))
(if (rktio-error? ltps)
@ -33,6 +31,9 @@
(define (shared-ltps-place-init!)
(set! shared-ltps (make-ltps)))
(define (shared-ltps-reset!)
(set! shared-ltps rktio_NULL))
;; ----------------------------------------
;; in atomic mode