mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-01 17:11:21 -04:00
update runtime thread tests
Threads are now removed after every "inner" step. Any thread that reaches its DONE conditions is immediately removed instead of requiring an extra step to remove it. As such tests that check the number of threads have been updated to consider this.
This commit is contained in:
parent
b833ef8d24
commit
2ffa8eb333
5 changed files with 73 additions and 34 deletions
src/engine
|
@ -188,6 +188,13 @@ class Runtime extends EventEmitter {
|
|||
*/
|
||||
this._nonMonitorThreadCount = 0;
|
||||
|
||||
/**
|
||||
* All threads that finished running and were removed from this.threads
|
||||
* by behaviour in Sequencer.stepThreads.
|
||||
* @type {Array<Thread>}
|
||||
*/
|
||||
this._lastStepDoneThreads = null;
|
||||
|
||||
/**
|
||||
* Currently known number of clones, used to enforce clone limit.
|
||||
* @type {number}
|
||||
|
@ -1560,6 +1567,9 @@ class Runtime extends EventEmitter {
|
|||
this._emitProjectRunStatus(
|
||||
this.threads.length + doneThreads.length -
|
||||
this._getMonitorThreadCount([...this.threads, ...doneThreads]));
|
||||
// Store threads that completed this iteration for testing and other
|
||||
// internal purposes.
|
||||
this._lastStepDoneThreads = doneThreads;
|
||||
if (this.renderer) {
|
||||
// @todo: Only render when this.redrawRequested or clones rendered.
|
||||
if (this.profiler !== null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue