From 5b4ccede3c90583624a787536a5e9d8eb697f62d Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sun, 3 Nov 2013 12:31:09 -0500 Subject: [PATCH] World.wrap'd functions should only run if their process is still alive --- marketplace.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/marketplace.js b/marketplace.js index 7f1832d..c4a890c 100644 --- a/marketplace.js +++ b/marketplace.js @@ -191,7 +191,7 @@ function World(bootFn) { this.processActions = []; this.activePid = null; this.stepperId = null; - this.asChild(-1, bootFn); + this.asChild(-1, bootFn, true); } /* Class state / methods */ @@ -285,7 +285,12 @@ World.prototype.stopStepping = function () { } }; -World.prototype.asChild = function (pid, f) { +World.prototype.asChild = function (pid, f, omitLivenessCheck) { + if (!(pid in this.processTable) && !omitLivenessCheck) { + console.warn("World.asChild eliding invocation of dead process", pid); + return; + } + World.stack.push(this); var result = null; this.activePid = pid;