mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-11-13 09:16:10 +08:00
Update 14.2.md (#666)
This commit is contained in:
@@ -251,7 +251,7 @@ sum := <- ch // wait for, and retrieve the sum
|
||||
|
||||
也可以使用通道来达到同步的目的,这个很有效的用法在传统计算机中称为信号量(semaphore)。或者换个方式:通过通道发送信号告知处理已经完成(在协程中)。
|
||||
|
||||
在其他协程运行时让 main 程序无限阻塞的通常做法是在 `main` 函数的最后放置一个{}。
|
||||
在其他协程运行时让 main 程序无限阻塞的通常做法是在 `main` 函数的最后放置一个 `select {}`。
|
||||
|
||||
也可以使用通道让 `main` 程序等待协程完成,就是所谓的信号量模式,我们会在接下来的部分讨论。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user