mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
uidriver/mobile: Bug fix: Freeze on Pixel 4
An Ebiten application often freezes on Pixel 4. Apparently adding loggings or runtime.Gosched hides the issue, though this doesn't fix the root cause. The root cause might be in gomobile itself, but it seeems really hard to make a minimum case. As a tentative fix, add runtime.Gosched to avoid freezing. Fixes #1322
This commit is contained in:
parent
179d32cfbf
commit
deb3d4a0c3
@ -19,6 +19,7 @@ package mobile
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
@ -107,6 +108,11 @@ func (u *UserInterface) Update() error {
|
||||
select {
|
||||
case <-workAvailable:
|
||||
u.glWorker.DoWork()
|
||||
|
||||
// This is a dirty hack to avoid freezing on Pixel 4 (#1322).
|
||||
// Apprently there is an issue in the usage of Worker in gomobile or gomobile itself.
|
||||
// At least, freezing doesn't happen with this Gosched.
|
||||
runtime.Gosched()
|
||||
case <-ctx.Done():
|
||||
break loop
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user