Modify the implementation of database RWLocks and RWUnLocks

This commit is contained in:
Eriri
2023-05-05 23:10:15 +08:00
committed by finley
parent 68d7f28b1a
commit 388fdabd7f
5 changed files with 397 additions and 32 deletions

View File

@@ -71,10 +71,10 @@ func (locks *Locks) RUnLock(key string) {
}
func (locks *Locks) toLockIndices(keys []string, reverse bool) []uint32 {
indexMap := make(map[uint32]bool)
indexMap := make(map[uint32]struct{})
for _, key := range keys {
index := locks.spread(fnv32(key))
indexMap[index] = true
indexMap[index] = struct{}{}
}
indices := make([]uint32, 0, len(indexMap))
for index := range indexMap {