请教一个通道chan 跟select 死循环问题

hong3088 · · 1198 次点击
这个有哪里文档说明吗?
#2
更多评论
你都close了,ch-Int就不阻塞了啊……
#1
https://tour.golang.org/concurrency/4 这里可以看到其实从chan里取数据可以取第二个参数,chan是否已经close而且没有需要读的值 https://tour.golang.org/concurrency/5 这里可以看到在select里,close chan一般的用途…… 就标准文档的话,看语言特性表: https://golang.org/ref/spec#Receive_operator A receive operation on a closed channel can always proceed immediately, yielding the element type's zero value after any previously sent values have been received.
#3