cs & thread: fix place custodian unregister

When a place terminates, it was directly accessing its parent's
custodian. Prior support for cross-place uses of a hash table
probably helped hide this problem previously.
This commit is contained in:
Matthew Flatt 2019-10-08 21:59:15 -06:00
parent aa4d65f3f2
commit 1a2c48cbd6

View File

@ -73,7 +73,6 @@
(host:mutex-acquire lock) (host:mutex-acquire lock)
(set-place-queued-result! new-place (if flush-failed? 1 (if (byte? v) v 0))) (set-place-queued-result! new-place (if flush-failed? 1 (if (byte? v) v 0)))
(place-has-activity! new-place) (place-has-activity! new-place)
(unsafe-custodian-unregister new-place (place-custodian-ref new-place))
(host:mutex-release lock)) (host:mutex-release lock))
;; Switch to scheduler, so it can exit: ;; Switch to scheduler, so it can exit:
(engine-block)) (engine-block))
@ -215,6 +214,10 @@
(set-place-host-thread! p #f) (set-place-host-thread! p #f)
#t))) #t)))
(log-place "reap" #:data (place-id p)))) (log-place "reap" #:data (place-id p))))
(define cref (place-custodian-ref p))
(when cref
(unsafe-custodian-unregister p cref)
(set-place-custodian-ref! p #f))
result) result)
;; In atomic mode, callback from custodian: ;; In atomic mode, callback from custodian: