Parcourir la source

switch to RLock

Patrick Lee il y a 11 ans
Parent
commit
fc018555d6
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      producer.go

+ 2 - 2
producer.go

@@ -110,8 +110,8 @@ func (p *Producer) Errors() chan error {
 // it may otherwise leak memory. You must call this before calling Close on the
 // underlying client.
 func (p *Producer) Close() error {
-	p.m.Lock()
-	defer p.m.Unlock()
+	p.m.RLock()
+	defer p.m.RUnlock()
 	for _, bp := range p.brokerProducers {
 		bp.Close()
 	}