From 29edf627785a2eaaf63a2d34d91b3a51f3eefeaf Mon Sep 17 00:00:00 2001 From: Ke Zhang Date: Wed, 31 Aug 2016 09:10:14 +0800 Subject: [PATCH] change sourcesSeenLock to sync.RWMutex --- pkg/kubelet/config/config.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/kubelet/config/config.go b/pkg/kubelet/config/config.go index 32e4a77f202..795fec62aa0 100644 --- a/pkg/kubelet/config/config.go +++ b/pkg/kubelet/config/config.go @@ -125,7 +125,7 @@ type podStorage struct { updates chan<- kubetypes.PodUpdate // contains the set of all sources that have sent at least one SET - sourcesSeenLock sync.Mutex + sourcesSeenLock sync.RWMutex sourcesSeen sets.String // the EventRecorder to use @@ -314,8 +314,8 @@ func (s *podStorage) markSourceSet(source string) { } func (s *podStorage) seenSources(sources ...string) bool { - s.sourcesSeenLock.Lock() - defer s.sourcesSeenLock.Unlock() + s.sourcesSeenLock.RLock() + defer s.sourcesSeenLock.RUnlock() return s.sourcesSeen.HasAll(sources...) }