Commit 88ba6458 authored by Lorenz Bauer's avatar Lorenz Bauer Committed by Brad Fitzpatrick

sync: enable profiling of RWMutex

Include reader / writer interactions of RWMutex in the mutex profile.
Writer contention is already included in the profile, since a plain Mutex
is used to control exclusion.

Fixes #18496

Change-Id: Ib0dc1ffa0fd5e6d964a6f7764d7f09556eb63f00
Reviewed-on: https://go-review.googlesource.com/87095
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: 's avatarPeter Weinberger <pjw@google.com>
parent 8cb4327e
......@@ -47,7 +47,7 @@ func (rw *RWMutex) RLock() {
}
if atomic.AddInt32(&rw.readerCount, 1) < 0 {
// A writer is pending, wait for it.
runtime_Semacquire(&rw.readerSem)
runtime_SemacquireMutex(&rw.readerSem, false)
}
if race.Enabled {
race.Enable()
......@@ -95,7 +95,7 @@ func (rw *RWMutex) Lock() {
r := atomic.AddInt32(&rw.readerCount, -rwmutexMaxReaders) + rwmutexMaxReaders
// Wait for active readers.
if r != 0 && atomic.AddInt32(&rw.readerWait, r) != 0 {
runtime_Semacquire(&rw.writerSem)
runtime_SemacquireMutex(&rw.writerSem, false)
}
if race.Enabled {
race.Enable()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment