minibear2333 / blog-comment

0 stars 0 forks source link

面试高频:Go语言死锁与goroutine泄露问题谈论 | 机智的程序员小熊 #23

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

面试高频:Go语言死锁与goroutine泄露问题谈论 | 机智的程序员小熊

本节源码位置 https://github.com/golang-minibear2333/golang/blob/master/4.concurrent/4.4-deadlock/

https://coding3min.com/1648.html

william-xue commented 3 years ago

很棒

minibear2333 commented 3 years ago

很棒

谢谢兄弟

william-xue commented 1 year ago

多年后 再次回味 感觉更加理解了。当初是可能转go的缘故来学习 ,可惜现在我工作中用不上了。但是还是很不错的。我私下一直理解channel就是go自己实现了一套消息队列,很优秀很棒。小熊书更棒。

william-xue commented 1 year ago

func multipleDeathLock2() { chanInt := make(chan int) defer close(chanInt) go func() { chanInt <- 1 chanInt <- 2 close(chanInt) // 关闭通道 }() for { res, ok := <-chanInt if !ok { break } fmt.Println(res) } }