Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
docs: update channel
  • Loading branch information
tangx committed Apr 16, 2021
commit 9531fb11d47663b62d434f16e4849fbfab42141b
5 changes: 2 additions & 3 deletions 5、channel.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@

* 给一个已经关闭的 channel 发送数据,引起 panic

* 从一个已经关闭的 channel 接收数据,如果缓冲区中为空,则返回一个零值
* 从一个已经关闭的 channel 接收数据,如果缓冲区中为空,则返回**一个零值 和 false** `val,ok:= <-ch1`

* 无缓冲的channel是同步的,而有缓冲的channel是非同步的

以上5个特性是死东西,也可以通过口诀来记忆:“空读写阻塞,写关闭异常,读关闭空零”。



![](images/169-channel异常情况总结.png)


> 执行下面的代码发生什么?
Expand Down
Binary file added images/169-channel异常情况总结.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.