Merge pull request from mzgoddard/stop-all-next-tick

Stop all next tick
This commit is contained in:
Karishma Chadha 2019-05-15 11:25:15 -04:00 committed by GitHub
commit 14d2820460
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions
src/engine

View file

@ -51,6 +51,8 @@ class Sequencer {
* @type {!Runtime}
*/
this.runtime = runtime;
this.activeThread = null;
}
/**
@ -97,8 +99,9 @@ class Sequencer {
numActiveThreads = 0;
let stoppedThread = false;
// Attempt to run each thread one time.
for (let i = 0; i < this.runtime.threads.length; i++) {
const activeThread = this.runtime.threads[i];
const threads = this.runtime.threads;
for (let i = 0; i < threads.length; i++) {
const activeThread = this.activeThread = threads[i];
// Check if the thread is done so it is not executed.
if (activeThread.stack.length === 0 ||
activeThread.status === Thread.STATUS_DONE) {
@ -165,6 +168,8 @@ class Sequencer {
}
}
this.activeThread = null;
return doneThreads;
}