Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改了ConcurrentDict的Get方法 #228

Closed
wants to merge 7 commits into from

Conversation

1024wangxiao
Copy link

源代码中的分段锁,Get方法使用的是Lock,应该使用RLock
// Get returns the binding value and whether the key is exist
func (dict *ConcurrentDict) Get(key string) (val interface{}, exists bool) {
if dict == nil {
panic("dict is nil")
}
hashCode := fnv32(key)
index := dict.spread(hashCode)
s := dict.getShard(index)
s.mutex.RLock()
defer s.mutex.RUnlock()
val, exists = s.m[key]
return
}

@HDT3213
Copy link
Owner

HDT3213 commented Jul 29, 2024

请将不必要的提交从 mr 中移除

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants