change sourcesSeenLock to sync.RWMutex

pull/6/head
Ke Zhang 2016-08-31 09:10:14 +08:00
parent 1c9332ab51
commit 29edf62778
1 changed files with 3 additions and 3 deletions

View File

@ -125,7 +125,7 @@ type podStorage struct {
updates chan<- kubetypes.PodUpdate updates chan<- kubetypes.PodUpdate
// contains the set of all sources that have sent at least one SET // contains the set of all sources that have sent at least one SET
sourcesSeenLock sync.Mutex sourcesSeenLock sync.RWMutex
sourcesSeen sets.String sourcesSeen sets.String
// the EventRecorder to use // the EventRecorder to use
@ -314,8 +314,8 @@ func (s *podStorage) markSourceSet(source string) {
} }
func (s *podStorage) seenSources(sources ...string) bool { func (s *podStorage) seenSources(sources ...string) bool {
s.sourcesSeenLock.Lock() s.sourcesSeenLock.RLock()
defer s.sourcesSeenLock.Unlock() defer s.sourcesSeenLock.RUnlock()
return s.sourcesSeen.HasAll(sources...) return s.sourcesSeen.HasAll(sources...)
} }