OctopusLian / leetcode-solutions

LeetCode,LintCode,牛客网,企业题库,《Sword to Offer》,《Cracking the Coding Interview》题解
MIT License
4 stars 4 forks source link

每日一题:go中channel的send流程是什么? #185

Closed OctopusLian closed 2 years ago

OctopusLian commented 4 years ago

https://www.yuque.com/fudadajiagoushimeiriyiti/rqui93/on2ww3 1.判断chan是否是nil 2.加锁 3.判断chan是否close 4.recvq队列是否存在goroutine中 5.环形缓冲buf是否已满 6.将goroutine追加到sendq中,阻塞,等待唤醒 7.解锁 8.释放suduG