From dd22b8b59910427792af2a18e29a9abee9de0a96 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 29 Apr 2019 16:19:35 -0600 Subject: [PATCH] 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. --- racket/src/io/sandman/ltps.rkt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/racket/src/io/sandman/ltps.rkt b/racket/src/io/sandman/ltps.rkt index a9c4d818ce..67f2eef2c1 100644 --- a/racket/src/io/sandman/ltps.rkt +++ b/racket/src/io/sandman/ltps.rkt @@ -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