Stop a new facet with no endpoints. Fixes #18.
This commit is contained in:
parent
6db1e67a7e
commit
46e5922dc8
|
@ -990,7 +990,9 @@
|
||||||
(lookup-facet fid)
|
(lookup-facet fid)
|
||||||
(patch (actor-state-knowledge (current-actor-state)) trie-empty)
|
(patch (actor-state-knowledge (current-actor-state)) trie-empty)
|
||||||
#t)
|
#t)
|
||||||
(when (and (facet-live? fid) (pair? parent-fid) (not (facet-live? parent-fid)))
|
(when (and (facet-live? fid)
|
||||||
|
(or (and (pair? parent-fid) (not (facet-live? parent-fid)))
|
||||||
|
(hash-empty? (facet-endpoints (lookup-facet fid)))))
|
||||||
(terminate-facet! fid)))
|
(terminate-facet! fid)))
|
||||||
|
|
||||||
;; If the named facet is live, terminate it.
|
;; If the named facet is live, terminate it.
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#lang syndicate/actor
|
||||||
|
;; Demonstrates that facets with no endpoints don't outlive their `add-facet!` call.
|
||||||
|
|
||||||
|
;; This actor will have two facets briefly, before dropping to one:
|
||||||
|
(spawn (on-start (react (on-start (printf "Hi 1!\n"))
|
||||||
|
(on-stop (printf "Bye 1!\n"))))
|
||||||
|
(assert 'x))
|
||||||
|
|
||||||
|
;; This actor will have one facet briefly, before dropping to zero and terminating:
|
||||||
|
(spawn (on-start (printf "Hi 2!\n"))
|
||||||
|
(on-stop (printf "Bye 2!\n")))
|
Loading…
Reference in New Issue