]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.11] runtime: ignore races between close and len/cap
authorKeith Randall <khr@google.com>
Mon, 17 Sep 2018 19:25:36 +0000 (12:25 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 27 Sep 2018 21:24:08 +0000 (21:24 +0000)
commite535c71009224422ae1853b88f071bb250eac1af
tree1c1ce74f76a6d3d88ecb9fad793af5ec69bb672a
parentb5ed6ec14092b04156adcbaba101958dc9d9d74b
[release-branch.go1.11] runtime: ignore races between close and len/cap

They aren't really races, or at least they don't have any
observable effect. The spec is silent on whether these are actually
races or not.

Fix this problem by not using the address of len (or of cap)
as the location where channel operations are recorded to occur.
Use a random other field of hchan for that.

I'm not 100% sure we should in fact fix this. Opinions welcome.

Fixes #27778

Change-Id: Ib4efd4b62e0d1ef32fa51e373035ef207a655084
Reviewed-on: https://go-review.googlesource.com/135698
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
(cherry picked from commit 83dfc3b001245f0b725afdc94c0b540fe1952d21)
Reviewed-on: https://go-review.googlesource.com/138179
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/chan.go
src/runtime/race/testdata/chan_test.go
src/runtime/select.go