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