mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
@ -107,6 +108,11 @@ func (u *UserInterface) Update() error {
|
|||||||
select {
|
select {
|
||||||
case <-workAvailable:
|
case <-workAvailable:
|
||||||
u.glWorker.DoWork()
|
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():
|
case <-ctx.Done():
|
||||||
break loop
|
break loop
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user