Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GR_SyncCond ¶
func GR_SyncCond()
*
- 代码逻辑释义 1.done 即互斥锁需要保护的条件变量。 2.read() 调用 Wait() 等待通知,直到 done 为 true。 3.write() 接收数据,接收完成后,将 done 置为 true,调用 Broadcast() 通知所有等待的协程。 4.write() 中的暂停了3s,一方面是模拟耗时,另一方面是确保前面的 3 个 read 协程都执行到 Wait(),处于等待状态。main 函数最后暂停了 2s,确保所有操作执行完毕。
func GR_SyncWaitGroup ¶
func GR_SyncWaitGroup()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.