查看 gobyexample.com 的示例:https://gobyexample.com/timers
timer2 := time.NewTimer(time.Second)
go func() {
<-timer2.C
fmt.Println("Timer 2 fired")
}()
stop2 := timer2.Stop()
if stop2 {
fmt.Println("Timer 2 stopped")
}
问题:停止后计时器会go func()
永远卡住吗?如果是,处理这种情况的正确方法是什么?