Support stopping a root facet, such as happens when a link between actors is broken

This commit is contained in:
Tony Garnock-Jones 2021-12-09 18:52:22 +01:00
parent 5455392efc
commit 20b83aa5a5
1 changed files with 8 additions and 4 deletions

View File

@ -302,10 +302,14 @@ export class Turn {
}
stop(facet: Facet = this.activeFacet, continuation?: LocalAction) {
this.enqueue(facet.parent!, () => {
facet._terminate(true);
if (continuation) continuation();
});
if (facet.parent === null) {
this.stopActor();
} else {
this.enqueue(facet.parent, () => {
facet._terminate(true);
if (continuation) continuation();
});
}
}
// Alias for syndicatec code generator to use