Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cr-mao/go-concurrency
go并发编程总结
https://github.com/cr-mao/go-concurrency
go-concurrency golang-concurrency sync
Last synced: 6 days ago
JSON representation
go并发编程总结
- Host: GitHub
- URL: https://github.com/cr-mao/go-concurrency
- Owner: cr-mao
- Created: 2023-04-13T13:53:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-08T09:16:12.000Z (3 months ago)
- Last Synced: 2024-08-09T11:32:26.057Z (3 months ago)
- Topics: go-concurrency, golang-concurrency, sync
- Language: Go
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Go Concurrency
go 并发相关总结
- sync.Mutex
- sync.RWMutex
- sync.Once
- sync.Cond
- sync.Map
- sync.WaitGroup
- sync.Pool
- channel
- context
- 内存模型如何选择
1. 共享资源的并发访问使用传统并发原语;
2. 复杂的任务编排和消息传递使用 Channel;
3. 消息通知机制使用 Channel,除非只想 signal 一个 goroutine,才使用 Cond;
4. 简单等待所有任务的完成用 WaitGroup,也有 Channel 的推崇者用 Channel,都可以;
5. 需要和 Select 语句结合,使用 Channel;
6. 需要和超时配合时,使用 Channel 和 Context。[go中happens-before 保证](memory/readme.md)
## links
- 《极客时间-go并发编程实战课》 - 鸟窝
- 《深入理解 go 并发编程 》- 鸟窝