re-use rand.New() do not repeat allocate. (#13448)

also simplify readerLocks to be just like
writeLocks, DRWMutex() is never shared
and there are order guarantees that need
for such a thing to work for RLock's
This commit is contained in:
Harshavardhana
2021-10-18 08:39:59 -07:00
committed by GitHub
parent d7b7040408
commit 838de23357
4 changed files with 90 additions and 24 deletions
+3
View File
@@ -306,6 +306,9 @@ func TestRUnlockPanic2(t *testing.T) {
// Borrowed from rwmutex_test.go
func benchmarkRWMutex(b *testing.B, localWork, writeRatio int) {
b.ResetTimer()
b.ReportAllocs()
rwm := NewDRWMutex(ds, "test")
b.RunParallel(func(pb *testing.PB) {
foo := 0