From 9e9041ac5f12eebe2820d6abd0e4786123a6e73f Mon Sep 17 00:00:00 2001 From: jmoenig Date: Mon, 3 Jan 2022 12:05:24 +0100 Subject: [PATCH] made "When I receive any messagge" non-thread-safe by default (again) to enable tail recursive broadcasts --- HISTORY.md | 2 ++ snap.html | 2 +- src/api.js | 6 ++++-- src/threads.js | 10 ++++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 4f015c18..d3638b66 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -5,6 +5,7 @@ * **New Features:** * **Notable Changes:** * same blocks with empty variadic inputs compare as equal regardless of their arity + * made "When I receive any messagge" non-thread-safe by default (again) to enable tail recursive broadcasts * **Notable Fixes:** * fixed storing the stage name(s) * removed distinction between number and string keys in "analyze" @@ -18,6 +19,7 @@ * Italian translation update, thanks, Stefano! * api: fixed variable binding when broadcasting through the API, thanks, Zak! * objects: fixed programmatically hiding palette blocks using the "hide variable" block, thanks, Zak! +* threads, api: made "When I receive any messagge" non-thread-safe by default (again) to enable tail recursive broadcasts ### 2022-01-02 * store: fixed storing the stage name(s) diff --git a/snap.html b/snap.html index 65e0e45b..47e9981a 100755 --- a/snap.html +++ b/snap.html @@ -17,7 +17,7 @@ - + diff --git a/src/api.js b/src/api.js index 3d6452ef..cfe3786a 100644 --- a/src/api.js +++ b/src/api.js @@ -148,8 +148,10 @@ IDE_Morph.prototype.broadcast = function(message, callback) { procs.push(this.stage.threads.startProcess( block, morph, - this.stage.isThreadSafe || // make "any msg" threadsafe - block.inputs()[0].evaluate() instanceof Array, + this.stage.isThreadSafe, + // commented out for now to enable tail recursion: + // || // make "any msg" threadsafe + // block.inputs()[0].evaluate() instanceof Array, null, // exportResult (bool) callback instanceof Function ? wait : null, null, // isClicked diff --git a/src/threads.js b/src/threads.js index dd5a7f3b..04ad1c73 100644 --- a/src/threads.js +++ b/src/threads.js @@ -9,7 +9,7 @@ written by Jens Mönig jens@moenig.org - Copyright (C) 2021 by Jens Mönig + Copyright (C) 2022 by Jens Mönig This file is part of Snap!. @@ -64,7 +64,7 @@ SnapExtensions, AlignmentMorph, TextMorph, Cloud, HatBlockMorph*/ /*jshint esversion: 6*/ -modules.threads = '2021-December-22'; +modules.threads = '2022-January-03'; var ThreadManager; var Process; @@ -3744,8 +3744,10 @@ Process.prototype.doBroadcast = function (message, receivers) { procs.push(stage.threads.startProcess( block, morph, - stage.isThreadSafe || // make "any msg" threadsafe - block.inputs()[0].evaluate() instanceof Array, + stage.isThreadSafe, + // commented out for now to enable tail recursion: + // || // make "any msg" threadsafe + // block.inputs()[0].evaluate() instanceof Array, null, // exportResult (bool) null, // callback null, // isClicked