![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
案例练习答案
普通网友
这个作者很懒,什么都没留下…
展开
-
goruntine+channel 案例练习一
package mainimport ( "fmt")var ( numChan = make(chan int,10) resChan = make(chan map[int]int,8) exitChan = make(chan bool,8))func main(){ //1 协程 存放数字 go func(){ for i:=1;i<=2000;i++{ numChan<-i } close(numChan) }() // 8 协程 取原创 2021-04-29 13:24:17 · 123 阅读 · 0 评论 -
goruntine+channel 案例练习2
package mainimport ( "fmt" "math/rand" "time" "bufio" "os" "sort")func main(){ //状态通道 writeDataOK := make(chan bool,1) rand.Seed(time.Now().UnixNano()) filePath:="d:/mydatatest.txt" go func(filePath string,writeDataOK chan bool){原创 2021-04-29 13:27:43 · 173 阅读 · 1 评论