Make threadSafeMap.ListIndexFuncValues thread safe.

Surprisingly, this method does not lock and I get data race reports
in my persistent volume unit tests (which use this map).
This commit is contained in:
Jan Safranek 2016-05-04 18:18:00 +02:00
parent 963aebd3e5
commit 42d940735b

View File

@ -179,6 +179,9 @@ func (c *threadSafeMap) ByIndex(indexName, indexKey string) ([]interface{}, erro
}
func (c *threadSafeMap) ListIndexFuncValues(indexName string) []string {
c.lock.RLock()
defer c.lock.RUnlock()
index := c.indices[indexName]
names := make([]string, 0, len(index))
for key := range index {