golang常见并发模型

102 阅读1分钟

1、channel无缓存通道

无缓存时,发送goroutine需要与接收goroutine同步

2、sync.WaitGroup

用于等待一组线程结束

3、Context