syncmap: release m.mu during (*RWMutexMap).Range callbacks
The mainline syncmap.Map has allowed mutations within Range callbacks since https://golang.org/cl/37342. The reference implementations used in map_bench_test need to do the same. Change-Id: Id73d254fa01cc64a1f00eb1903488796e1282423 Reviewed-on: https://go-review.googlesource.com/42956 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
305c7b3edb
commit
57af736625
2 changed files with 12 additions and 5 deletions
|
|
@ -204,12 +204,10 @@ func BenchmarkAdversarialDelete(b *testing.B) {
|
|||
m.Load(i)
|
||||
|
||||
if i%mapSize == 0 {
|
||||
var key int
|
||||
m.Range(func(k, _ interface{}) bool {
|
||||
key = k.(int)
|
||||
m.Delete(k)
|
||||
return false
|
||||
})
|
||||
m.Delete(key)
|
||||
m.Store(i, i)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue