mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-27 22:50:22 -04:00
Clean up yield-timers: support multiple, move logic to Threads.
This commit is contained in:
parent
578d02cba0
commit
190208b620
4 changed files with 34 additions and 38 deletions
src/engine
|
@ -53,10 +53,10 @@ Sequencer.prototype.stepThreads = function (threads) {
|
|||
// Normal-mode thread: step.
|
||||
this.startThread(activeThread);
|
||||
} else if (activeThread.status === Thread.STATUS_YIELD) {
|
||||
// Yield-mode thread: check if the time has passed.
|
||||
if (!YieldTimers.resolve(activeThread.yieldTimerId)) {
|
||||
// Thread is still yielding
|
||||
// if YieldTimers.resolve returns false.
|
||||
// Yield-mode thread: resolve timers.
|
||||
activeThread.resolveTimeouts();
|
||||
if (activeThread.status === Thread.STATUS_YIELD) {
|
||||
// Still yielding.
|
||||
numYieldingThreads++;
|
||||
}
|
||||
} else if (activeThread.status === Thread.STATUS_DONE) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue