package main import ( "fmt" ) func Count(ch chan int) { fmt.Println("before") ch <- 1 fmt.Println("after") } func main() { s := make([]chan int, 10) for i := 0; i < 10; i++ { s[i] = make(chan int) go Count(s[i]) } for _, ch := range s { <-ch } }
举报
本版积分规则 发表回复 回帖后跳转到最后一页
Archiver|手机版|小黑屋|学习笔记
GMT+8, 2024-9-8 09:27 , Processed in 0.023633 second(s), 14 queries , APCu On.
Powered by Discuz! X3.5
© 2001-2024 Discuz! Team.