Posted on 2013-10-10 15:07
oathleo 阅读(1658)
评论(0) 编辑 收藏 所属分类:
Golang
// (A)
time.AfterFunc(5 * time.Minute, func() {
fmt.Printf("expired")
}
// (B) create a Timer object
timer := time.NewTimer(5 * time.Minute)
<-timer.C
fmt.Printf("expired")
// (C) time.After() returns timer.C internally
<-time.After(5 * time.Minute)
fmt.Printf("expired")