看程序:
package main
import (
"fmt"
"time"
)
func main() {
time.AfterFunc(3 * time.Second, func() {fmt.Println("come here 1")})
timer := time.NewTimer(4 * time.Second)
<-timer.C
fmt.Println("come here 2")
<-time.After(5 * time.Second)
fmt.Printf("come here 3")
for {}
}
一目了然。