Skip to content
Snippets Groups Projects
Commit 059f9b85 authored by scott's avatar scott
Browse files

Add double check for RWMutex

parent ae667e98
No related branches found
No related tags found
No related merge requests found
......@@ -166,6 +166,12 @@ func (l *EventListener) ListenServiceEvent(key string, listener remoting.DataLis
}
l.keyMapLock.Lock()
// double check
if _, ok := l.keyMap[key]; ok {
// another goroutine already set it
l.keyMapLock.Unlock()
return
}
l.keyMap[key] = struct{}{}
l.keyMapLock.Unlock()
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment