1
0
mirror of https://github.com/kidoman/embd synced 2024-12-22 12:50:19 +01:00

moving ticker.Stop to defer statement when creating ticker

This commit is contained in:
Ben Schwartz 2015-03-31 20:22:47 -05:00
parent 333194b96f
commit 3574e65c8d

View File

@ -74,6 +74,7 @@ func main() {
// Start main loop // Start main loop
ticker := time.NewTicker(time.Duration(*stepDelay) * time.Millisecond) ticker := time.NewTicker(time.Duration(*stepDelay) * time.Millisecond)
defer ticker.Stop()
var stepCounter int var stepCounter int
for { for {
@ -102,7 +103,6 @@ func main() {
} }
case <-quit: case <-quit:
ticker.Stop()
return return
} }
} }