首页 > TAG信息列表 > RwMap
go 自定义RWMutex
package main import ( "fmt" "strconv" "sync" ) type RwMap struct{ mu sync.RWMutex data map[string]int } func New() *RwMap { return &RwMap{data: make(map[string]int)} } func (r *RwMap )Read(key string)int { r.mu.go 自定义RWMutex
package main import ( "fmt" "strconv" "sync" ) type RwMap struct{ mu sync.RWMutex data map[string]int } func New() *RwMap { return &RwMap{data: make(map[string]int)} } func (r *RwMap )Read(key string)int { r.mu.