Skip to content

Commit 9531fb1

Browse files
committed
docs: update channel
1 parent 15ed23f commit 9531fb1

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

5、channel.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212

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

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

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

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

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

2423

2524
> 执行下面的代码发生什么?
968 KB
Loading

0 commit comments

Comments
 (0)