clock: Bug fix: function registerd OnStart might not be called

Fixes #645
This commit is contained in:
Hajime Hoshi 2018-09-03 00:35:07 +09:00
parent d5ca4c3953
commit 3d24ffe3e0

View File

@ -30,8 +30,8 @@ var (
fpsCount = 0
tpsCount = 0
started bool
onStart func()
onStartCalled bool
onStart func()
m sync.Mutex
)
@ -132,11 +132,11 @@ func Update(tps int) int {
m.Lock()
defer m.Unlock()
if !started {
if !onStartCalled {
if onStart != nil {
onStart()
onStartCalled = true
}
started = true
}
n := now()