summaryrefslogtreecommitdiffhomepage
path: root/pkg/sync/rwmutex_unsafe.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-11-19 22:32:43 +0000
committergVisor bot <gvisor-bot@google.com>2020-11-19 22:32:43 +0000
commita8329e99c58d315bfe748c667f6ce133cd6e4198 (patch)
treeaf58cce507081d908debf40f0e5a326678a988b2 /pkg/sync/rwmutex_unsafe.go
parent7dcd014bcfe17836a8ef57e0f840d3c574d07965 (diff)
parent3454d572199679d6abc66c0c29539829dd9baf51 (diff)
Merge release-20201109.0-89-g3454d5721 (automated)
Diffstat (limited to 'pkg/sync/rwmutex_unsafe.go')
-rw-r--r--pkg/sync/rwmutex_unsafe.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/sync/rwmutex_unsafe.go b/pkg/sync/rwmutex_unsafe.go
index b3b4dee78..fa023f5bb 100644
--- a/pkg/sync/rwmutex_unsafe.go
+++ b/pkg/sync/rwmutex_unsafe.go
@@ -32,7 +32,12 @@ func runtimeSemrelease(s *uint32, handoff bool, skipframes int)
// RWMutex is identical to sync.RWMutex, but adds the DowngradeLock,
// TryLock and TryRLock methods.
type RWMutex struct {
- w Mutex // held if there are pending writers
+ // w is held if there are pending writers
+ //
+ // We use CrossGoroutineMutex rather than Mutex because the lock
+ // annotation instrumentation in Mutex will trigger false positives in
+ // the race detector when called inside of RaceDisable.
+ w CrossGoroutineMutex
writerSem uint32 // semaphore for writers to wait for completing readers
readerSem uint32 // semaphore for readers to wait for completing writers
readerCount int32 // number of pending readers