From d8d1810e436cba83144f4b2234fc3097a739208b Mon Sep 17 00:00:00 2001 From: Hardmath123 Date: Sun, 22 Dec 2013 16:28:11 -0800 Subject: Initial stop others block --- threads.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'threads.js') diff --git a/threads.js b/threads.js index d1e57d3..25659b5 100644 --- a/threads.js +++ b/threads.js @@ -168,6 +168,17 @@ ThreadManager.prototype.stopAllForReceiver = function (rcvr) { }); }; +ThreadManager.prototype.stopAllForReceiverExcept = function (rcvr, excpt) { + this.processes.forEach(function (proc) { + if (proc.homeContext.receiver === rcvr && proc != excpt) { + proc.stop(); + if (rcvr.isClone) { + proc.isDead = true; + } + } + }); +}; + ThreadManager.prototype.stopProcess = function (block) { var active = this.findProcess(block); if (active) { @@ -1368,6 +1379,16 @@ Process.prototype.doStopAll = function () { } }; +Process.prototype.doStopOthers = function () { + var stage, ide; + if (this.homeContext.receiver) { + stage = this.homeContext.receiver.parentThatIsA(StageMorph); + if (stage) { + stage.threads.stopAllForReceiverExcept(this.homeContext.receiver, this); + } + } +}; + Process.prototype.doWarp = function (body) { // execute my contents block atomically (more or less) var outer = this.context.outerContext, // for tail call elimination -- cgit v1.3.1