sync.Map
已收录文章:2篇
-
Golang · Go问答 | 4天前 | 并发 · map · RWMutex · sync.Map · Go问答 · 数据竞争 RWMutex sync.Map map并发读写 Go问答 concurrent map read and map writeGo 原生 map 不是并发安全容器,只要一个 goroutine 写 map,同时另一个 goroutine 读或写同一个 map,就可能触发 concurrent map read and map write。生产代码要按访问模式选择 RWMutex、单协程归口或 sync.Map。291 收藏
-
Golang · Go问答 | 5天前 | 并发安全 · RWMutex · sync.Map · Go问答 · map并发 · RWMutex sync.Map Go问答 Go map并发读写 concurrent map writesGo map 不是并发安全容器,多个 goroutine 同时写或读写交错时可能触发 fatal error。本文从线上 panic 现场出发,说明如何复现、定位原因,并在 RWMutex、sync.Map 和单 owner 模型之间做选择。102 收藏