这更像是另一个帖子的后续问题
我不明白为什么添加第二个通道(在我的例子中是 c2)会导致死锁。通道是独立的,我不明白为什么 c2 应该被阻止
func do_stuff(done chan bool) {
fmt.Println("Doing stuff")
done <- true
}
func main() {
fmt.Println("Main")
done := make(chan bool)
go do_stuff(done)
<-done
//Up tp here everything works
c2 := make(chan int)
c2 <- 1
fmt.Println("Exit ",<-c2)
}
倚天杖
米琪卡哇伊
具有多个等待组的管道中通道范围内的死锁
锁机制:读锁会导致写锁死锁吗
死锁问题不明白
第一次立即执行setInterval函数
相关分类