Add isActiveThread and simplify broadcast-and-wait accordingly

This commit is contained in:
Tim Mickel 2016-08-29 10:01:31 -04:00
parent 64b82f4dc2
commit 40c90bbcc7
2 changed files with 13 additions and 8 deletions
src/engine

View file

@ -211,6 +211,15 @@ Runtime.prototype._removeThread = function (thread) {
}
};
/**
* Return whether a thread is currently active/running.
* @param {?Thread} thread Thread object to check.
* @return {Boolean} True if the thread is active/running.
*/
Runtime.prototype.isActiveThread = function (thread) {
return this.threads.indexOf(thread) > -1;
};
/**
* Toggle a script.
* @param {!string} topBlockId ID of block that starts the script.