From a58fa43572bef208d2b264d5611a531aed395e5b Mon Sep 17 00:00:00 2001 From: Tim Mickel Date: Fri, 10 Jun 2016 13:38:35 -0400 Subject: [PATCH] Add reset to `numYieldingThreads` and comment about YieldTimers --- src/engine/sequencer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/engine/sequencer.js b/src/engine/sequencer.js index 6659f12d8..deaa15266 100644 --- a/src/engine/sequencer.js +++ b/src/engine/sequencer.js @@ -44,6 +44,8 @@ Sequencer.prototype.stepThreads = function (threads) { this.timer.timeElapsed() < Sequencer.WORK_TIME) { // New threads at the end of the iteration. var newThreads = []; + // Reset yielding thread count. + numYieldingThreads = 0; // Attempt to run each thread one time for (var i = 0; i < threads.length; i++) { var activeThread = threads[i]; @@ -53,6 +55,8 @@ Sequencer.prototype.stepThreads = function (threads) { } 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. numYieldingThreads++; } } else if (activeThread.status === Thread.STATUS_DONE) {