fix custodian-managed-list: omit custodian-boxes

This commit is contained in:
Ryan Culpepper 2020-12-17 14:31:16 +01:00
parent 52676db959
commit a08a6b4904
3 changed files with 33 additions and 2 deletions

View File

@ -432,6 +432,15 @@
(test #f pair? (member sp (custodian-managed-list c2 c)))
(custodian-shutdown-all c))
;; Check custodian-boxes are omitted by custodian-managed-list:
(let* ([c (make-custodian)]
[c2 (make-custodian c)])
(define cb (make-custodian-box c2 'value))
(test '() custodian-managed-list c2 c)
(test 'value custodian-box-value cb)
(custodian-shutdown-all c2)
(test #f custodian-box-value cb))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; process groups
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -5732,7 +5732,27 @@
c_0
"second custodian"
super-c_0))
(hash-keys (custodian-children c_0)))))))
(reverse$1
(let ((ht_0 (custodian-children c_0)))
(begin
(letrec*
((for-loop_0
(|#%name|
for-loop
(lambda (fold-var_0 i_0)
(begin
(if i_0
(let ((v_0 (hash-iterate-key ht_0 i_0)))
(let ((fold-var_1
(if (not (1/custodian-box? v_0))
(let ((fold-var_1 (cons v_0 fold-var_0)))
(values fold-var_1))
fold-var_0)))
(for-loop_0
fold-var_1
(hash-iterate-next ht_0 i_0))))
fold-var_0))))))
(for-loop_0 null (hash-iterate-first ht_0)))))))))))
(define 1/custodian-memory-accounting-available?
(|#%name| custodian-memory-accounting-available? (lambda () (begin #t))))
(define 1/custodian-require-memory

View File

@ -381,7 +381,9 @@
(raise-arguments-error who "the second custodian does not manage the first custodian"
"first custodian" c
"second custodian" super-c))
(hash-keys (custodian-children c)))
(for/list ([v (in-hash-keys (custodian-children c))]
#:when (not (custodian-box? v)))
v))
(define (custodian-memory-accounting-available?)
#t)