]> Cypherpunks repositories - gostls13.git/commit
runtime: ignore races between close and len/cap
authorKeith Randall <khr@google.com>
Mon, 17 Sep 2018 19:25:36 +0000 (12:25 -0700)
committerKeith Randall <khr@golang.org>
Tue, 18 Sep 2018 17:28:37 +0000 (17:28 +0000)
commit83dfc3b001245f0b725afdc94c0b540fe1952d21
tree98e163cfa41ec69883528ab967be4beb1bceeb39
parent77f9b2728eb08456899e6500328e00ec4829dddf
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 #27070

Change-Id: Ib4efd4b62e0d1ef32fa51e373035ef207a655084
Reviewed-on: https://go-review.googlesource.com/135698
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
src/runtime/chan.go
src/runtime/race/testdata/chan_test.go
src/runtime/select.go