GO 无缓冲通道和有缓冲通道
Monday, November 2, 2020
无缓冲通道 func main() { c := make(chan int) go func() { time.Sleep(3 * time.Second) fmt.Println("receive") fmt.Println(<-c) }() c <- 1 fmt.Println("send") } 执行结果。 receive 1 send 对于无缓冲通道,必须得send goroutine和receive goro…