mirror of
https://gitee.com/johng/gf
synced 2026-07-04 21:03:13 +08:00
数据结构容器增加并发安全特性开启/关闭功能,当关闭后和普通的数据结构无异,非并发安全模式下性能会得到提高
This commit is contained in:
@ -8,17 +8,18 @@
|
||||
package gmap
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"gitee.com/johng/gf/g/container/internal/rwmutex"
|
||||
)
|
||||
|
||||
type InterfaceInterfaceMap struct {
|
||||
mu sync.RWMutex
|
||||
mu *rwmutex.RWMutex
|
||||
m map[interface{}]interface{}
|
||||
}
|
||||
|
||||
func NewInterfaceInterfaceMap() *InterfaceInterfaceMap {
|
||||
func NewInterfaceInterfaceMap(safe...bool) *InterfaceInterfaceMap {
|
||||
return &InterfaceInterfaceMap{
|
||||
m: make(map[interface{}]interface{}),
|
||||
m : make(map[interface{}]interface{}),
|
||||
mu : rwmutex.New(safe...),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user