Explorar o código

Merge pull request #30719 from alfred-landrum/gdcounter

Fix RefCounter count return
Alexander Morozov %!s(int64=8) %!d(string=hai) anos
pai
achega
70dc4cd446
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      daemon/graphdriver/counter.go

+ 4 - 2
daemon/graphdriver/counter.go

@@ -40,8 +40,9 @@ func (c *RefCounter) Increment(path string) int {
 		}
 	}
 	m.count++
+	count := m.count
 	c.mu.Unlock()
-	return m.count
+	return count
 }
 
 // Decrement decreases the ref count for the given id and returns the current count
@@ -62,6 +63,7 @@ func (c *RefCounter) Decrement(path string) int {
 		}
 	}
 	m.count--
+	count := m.count
 	c.mu.Unlock()
-	return m.count
+	return count
 }