From 0a239b703c8c7fde5540ce63c4236522a22ee049 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Thu, 11 Dec 2014 14:17:29 +0100 Subject: yield after each cycle in the experimental “forEach” primitive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit thanks, Bernat, for reporting this bug! --- threads.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'threads.js') diff --git a/threads.js b/threads.js index c21375e..b80ee9e 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2014-December-04'; +modules.threads = '2014-December-11'; var ThreadManager; var Process; @@ -1695,6 +1695,7 @@ Process.prototype.doForEach = function (upvar, list, script) { ); if (index > list.length()) {return; } this.context.inputs[3] += 1; + this.pushContext('doYield'); this.pushContext(); this.evaluate(script, new List(), true); }; -- cgit v1.3.1 From fc256e9e727bfe85fbf885cc65afa3b152430c71 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 17 Dec 2014 09:41:21 +0100 Subject: Remove terminated processes from expired clones --- history.txt | 1 + threads.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'threads.js') diff --git a/history.txt b/history.txt index 2f82c32..1ec5c83 100755 --- a/history.txt +++ b/history.txt @@ -2402,3 +2402,4 @@ ______ 141217 ------ * Objects, Store: Experimental “processes” count watcher (hidden in dev mode) +* Threads: Remove terminated processes from expired clones diff --git a/threads.js b/threads.js index b80ee9e..6078f5b 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2014-December-11'; +modules.threads = '2014-December-17'; var ThreadManager; var Process; @@ -234,7 +234,7 @@ ThreadManager.prototype.removeTerminatedProcesses = function () { // and un-highlight their scripts var remaining = []; this.processes.forEach(function (proc) { - if (!proc.isRunning() && !proc.errorFlag && !proc.isDead) { + if ((!proc.isRunning() && !proc.errorFlag) || proc.isDead) { if (proc.topBlock instanceof BlockMorph) { proc.topBlock.removeHighlight(); } -- cgit v1.3.1 From b31df39d7f126eaa303c8dae1cf6a14c739a2cc5 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 17 Dec 2014 12:35:13 +0100 Subject: Let “zombifying” scripts access receivers’ local vars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- history.txt | 1 + threads.js | 1 + 2 files changed, 2 insertions(+) (limited to 'threads.js') diff --git a/history.txt b/history.txt index 1ec5c83..6d6f0ff 100755 --- a/history.txt +++ b/history.txt @@ -2403,3 +2403,4 @@ ______ ------ * Objects, Store: Experimental “processes” count watcher (hidden in dev mode) * Threads: Remove terminated processes from expired clones +* Threads: Let “zombifying” scripts access receivers’ local vars diff --git a/threads.js b/threads.js index 6078f5b..791d81c 100644 --- a/threads.js +++ b/threads.js @@ -2546,6 +2546,7 @@ Process.prototype.reportContextFor = function (context, otherObj) { if (result.outerContext) { result.outerContext = copy(result.outerContext); result.outerContext.receiver = otherObj; + result.outerContext.variables.parentFrame = otherObj.variables; } return result; }; -- cgit v1.3.1 From 04ffda276e0294996431da8aca3584918873ae4f Mon Sep 17 00:00:00 2001 From: jmoenig Date: Mon, 12 Jan 2015 10:17:13 +0100 Subject: Speed up messages received by clones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t highlight scripts running inside clones (boosts performance), Thanks, @aranlunzer, for the hint! --- threads.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'threads.js') diff --git a/threads.js b/threads.js index 791d81c..555e531 100644 --- a/threads.js +++ b/threads.js @@ -9,7 +9,7 @@ written by Jens Mönig jens@moenig.org - Copyright (C) 2014 by Jens Mönig + Copyright (C) 2015 by Jens Mönig This file is part of Snap!. @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2014-December-17'; +modules.threads = '2014-January-12'; var ThreadManager; var Process; @@ -159,9 +159,11 @@ ThreadManager.prototype.startProcess = function ( active.stop(); this.removeTerminatedProcesses(); } - top.addHighlight(); newProc = new Process(block.topBlock(), callback); newProc.exportResult = exportResult; + if (!newProc.homeContext.receiver.isClone) { + top.addHighlight(); + } this.processes.push(newProc); return newProc; }; -- cgit v1.3.1 From ff3eed45eae2f4af3df5b636cdd59cabf9581e9b Mon Sep 17 00:00:00 2001 From: jmoenig Date: Mon, 12 Jan 2015 10:45:21 +0100 Subject: correct threads.js version happy New Year, duh :-) --- threads.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'threads.js') diff --git a/threads.js b/threads.js index 555e531..e07059f 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2014-January-12'; +modules.threads = '2015-January-12'; var ThreadManager; var Process; -- cgit v1.3.1