uidriver/mobile: Simplify updating logic

This commit is contained in:
Hajime Hoshi 2019-08-19 00:13:56 +09:00
parent 2c770f3644
commit 6cd74a9f4d

View File

@ -269,19 +269,16 @@ func (u *UserInterface) scaleImpl() float64 {
} }
func (u *UserInterface) update(context driver.UIContext) error { func (u *UserInterface) update(context driver.UIContext) error {
render: t := time.NewTimer(500 * time.Millisecond)
for { defer t.Stop()
t := time.NewTimer(500 * time.Millisecond)
defer t.Stop()
select { select {
case <-renderCh: case <-renderCh:
break render case <-t.C:
case <-t.C: context.SuspendAudio()
context.SuspendAudio() <-renderCh
continue
}
} }
context.ResumeAudio() context.ResumeAudio()
defer func() { defer func() {