run actions only in the right state

This commit is contained in:
Alfred Melch 2019-08-10 20:49:57 +02:00
parent 310a680f6b
commit 332c33480c

View File

@ -56,17 +56,25 @@ export class BenchmarkSuite {
} }
start() { start() {
this.state = 'running' if (this.state === 'initialized' || this.state === 'paused') {
this.run() this.state = 'running'
this.run()
}
} }
pause() { pause() {
this.state = 'pause_requested' if (this.state === 'running') this.state = 'pause_requested'
} }
stop() { stop() {
this.state = 'stop_requested' if (
this.run() this.state === 'running' ||
this.state === 'paused' ||
this.state === 'finished'
) {
this.state = 'stop_requested'
this.run()
}
} }
} }