摘要:
sync.WaitGroup 优雅的同步执行协程 package main import ( "fmt" "math/rand" "sync" "time" ) func f1(i int) { defer wg.Done() rand.Seed(time.Now().UnixNano()) tim 阅读全文
posted @ 2021-03-05 21:24
GPHPER
阅读(159)
评论(0)
推荐(0)
摘要:
select就是用来监听和channel有关的IO操作,当 IO 操作发生时,触发相应的动作 package main import ( "fmt" "time" ) func main() { ch := make(chan int) o := make(chan bool) go func() 阅读全文
posted @ 2021-03-05 20:57
GPHPER
阅读(78)
评论(0)
推荐(0)