mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 03:02:49 +01:00
parent
0beddf5519
commit
b620b4334e
@ -67,14 +67,13 @@ func getDelayedFuncsAndClearSlow() []func() error {
|
|||||||
func tryAddDelayedCommand(f func(obj interface{}) error, ondelayed func() interface{}) bool {
|
func tryAddDelayedCommand(f func(obj interface{}) error, ondelayed func() interface{}) bool {
|
||||||
if atomic.LoadUint32(&delayedCommandsFlushed) == 0 {
|
if atomic.LoadUint32(&delayedCommandsFlushed) == 0 {
|
||||||
// Outline the slow-path to expect the fast-path is inlined.
|
// Outline the slow-path to expect the fast-path is inlined.
|
||||||
tryAddDelayedCommandSlow(f, ondelayed)
|
return tryAddDelayedCommandSlow(f, ondelayed)
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func tryAddDelayedCommandSlow(f func(obj interface{}) error, ondelayed func() interface{}) {
|
func tryAddDelayedCommandSlow(f func(obj interface{}) error, ondelayed func() interface{}) bool {
|
||||||
delayedCommandsM.Lock()
|
delayedCommandsM.Lock()
|
||||||
defer delayedCommandsM.Unlock()
|
defer delayedCommandsM.Unlock()
|
||||||
|
|
||||||
@ -86,7 +85,10 @@ func tryAddDelayedCommandSlow(f func(obj interface{}) error, ondelayed func() in
|
|||||||
delayedCommands = append(delayedCommands, func() error {
|
delayedCommands = append(delayedCommands, func() error {
|
||||||
return f(obj)
|
return f(obj)
|
||||||
})
|
})
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkDelayedCommandsFlushed(fname string) {
|
func checkDelayedCommandsFlushed(fname string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user