mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-10 21:39:57 -04:00
Remove VM-locking yield mode per discussion
This commit is contained in:
parent
9a7ab57f6f
commit
6daee9a70e
4 changed files with 2 additions and 44 deletions
src/engine
|
@ -32,13 +32,6 @@ Sequencer.WORK_TIME = 10;
|
|||
Sequencer.prototype.stepThreads = function (threads) {
|
||||
// Start counting toward WORK_TIME
|
||||
this.timer.start();
|
||||
// Check for a blocking thread.
|
||||
var blockingThread = this.getBlockingThread_(threads);
|
||||
if (blockingThread) {
|
||||
// Attempt to resolve any timeouts, but otherwise stop stepping.
|
||||
blockingThread.resolveTimeouts();
|
||||
return [];
|
||||
}
|
||||
// List of threads which have been killed by this step.
|
||||
var inactiveThreads = [];
|
||||
// If all of the threads are yielding, we should yield.
|
||||
|
@ -70,10 +63,6 @@ Sequencer.prototype.stepThreads = function (threads) {
|
|||
activeThread.status = Thread.STATUS_RUNNING;
|
||||
// @todo Deal with the return value
|
||||
}
|
||||
// Has the thread gone into "blocking" mode? If so, stop stepping.
|
||||
if (activeThread.status === Thread.STATUS_YIELD_BLOCK) {
|
||||
return inactiveThreads;
|
||||
}
|
||||
if (activeThread.stack.length === 0 &&
|
||||
activeThread.status === Thread.STATUS_DONE) {
|
||||
// Finished with this thread - tell runtime to clean it up.
|
||||
|
@ -89,20 +78,6 @@ Sequencer.prototype.stepThreads = function (threads) {
|
|||
return inactiveThreads;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the thread blocking all other threads, if one exists.
|
||||
* @param {Array.<Thread>} threads List of which threads to check.
|
||||
* @return {?Thread} The blocking thread if one exists.
|
||||
*/
|
||||
Sequencer.prototype.getBlockingThread_ = function (threads) {
|
||||
for (var i = 0; i < threads.length; i++) {
|
||||
if (threads[i].status === Thread.STATUS_YIELD_BLOCK) {
|
||||
return threads[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Step the requested thread
|
||||
* @param {!Thread} thread Thread object to step
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue