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 {
render:
for {
t := time.NewTimer(500 * time.Millisecond)
defer t.Stop()
t := time.NewTimer(500 * time.Millisecond)
defer t.Stop()
select {
case <-renderCh:
break render
case <-t.C:
context.SuspendAudio()
continue
}
select {
case <-renderCh:
case <-t.C:
context.SuspendAudio()
<-renderCh
}
context.ResumeAudio()
defer func() {