summaryrefslogtreecommitdiffhomepage
path: root/third_party
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2019-09-06 17:23:15 -0700
committergVisor bot <gvisor-bot@google.com>2019-09-06 17:25:07 -0700
commit9e1cbdf565a1f5bf5bbc84bad0103fe2289e817c (patch)
treea314fc1e1eb496f7dfcff6177b85597acf306b91 /third_party
parent98f7fbb59fc5aca00f47a8145ce1227550869cb8 (diff)
Indicate flipcall synchronization to the Go race detector.
Since each Endpoint has a distinct mapping of the packet window, the Go race detector does not recognize accesses by connected Endpoints to be related. This means that this change isn't necessary for the Go race detector to accept accesses of flipcall.Endpoint.Data(), but it *is* necessary for it to accept accesses to shared variables outside the scope of flipcall that are synchronized by flipcall.Endpoint state; see updated test for an example. RaceReleaseMerge is needed (instead of RaceRelease) because calls to raceBecomeInactive() from *unrelated* Endpoints can occur in any order. (DowngradableRWMutex.RUnlock() has a similar property: calls to RUnlock() on the same DowngradableRWMutex from different goroutines can occur in any order. Remove the TODO asking to explain this now that this is understood.) PiperOrigin-RevId: 267705325
Diffstat (limited to 'third_party')
-rw-r--r--third_party/gvsync/downgradable_rwmutex_unsafe.go3
1 files changed, 0 insertions, 3 deletions
diff --git a/third_party/gvsync/downgradable_rwmutex_unsafe.go b/third_party/gvsync/downgradable_rwmutex_unsafe.go
index 069939033..1f6007aa1 100644
--- a/third_party/gvsync/downgradable_rwmutex_unsafe.go
+++ b/third_party/gvsync/downgradable_rwmutex_unsafe.go
@@ -57,9 +57,6 @@ func (rw *DowngradableRWMutex) RLock() {
// RUnlock undoes a single RLock call.
func (rw *DowngradableRWMutex) RUnlock() {
if RaceEnabled {
- // TODO(jamieliu): Why does this need to be ReleaseMerge instead of
- // Release? IIUC this establishes Unlock happens-before RUnlock, which
- // seems unnecessary.
RaceReleaseMerge(unsafe.Pointer(&rw.writerSem))
RaceDisable()
}