Commit to having onStop shutdownActions run in parent facet context

This commit is contained in:
Tony Garnock-Jones 2022-11-24 14:29:51 +01:00
parent 83b0cd41e0
commit d4a03a3f7c
1 changed files with 6 additions and 1 deletions

View File

@ -257,7 +257,12 @@
(with-active-facet f
(lambda ()
(for [(c (in-hash-keys (facet-children f)))] (facet-terminate! c orderly?))
(when orderly? (for [(h (in-list (reverse (facet-shutdown-actions f))))] (h)))
(when orderly?
(let ((actions (reverse (facet-shutdown-actions f))))
(unless (null? actions)
(with-active-facet (or parent f)
(lambda ()
(for [(h (in-list actions))] (h)))))))
(let ((turn (current-turn)))
(for [(a (in-hash-values (facet-outbound f)))] (turn-retract!* turn a)))
(when orderly?