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() {
this.state = 'running'
this.run()
if (this.state === 'initialized' || this.state === 'paused') {
this.state = 'running'
this.run()
}
}
pause() {
this.state = 'pause_requested'
if (this.state === 'running') this.state = 'pause_requested'
}
stop() {
this.state = 'stop_requested'
this.run()
if (
this.state === 'running' ||
this.state === 'paused' ||
this.state === 'finished'
) {
this.state = 'stop_requested'
this.run()
}
}
}