aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/chan.c
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2014-01-21 11:17:44 +0400
committerDmitriy Vyukov <dvyukov@google.com>2014-01-21 11:17:44 +0400
commitabd588aa835fa3f462640cc8eba6d192a8462667 (patch)
tree91008b93cd5e6994630f3187b79df281d21e468c /src/pkg/runtime/chan.c
parentd5a36cd6bb14a3bf00c58779848beeaeb87ade7d (diff)
downloadgo-abd588aa835fa3f462640cc8eba6d192a8462667.tar.xz
runtime: fix race detector by recording read by chansend.
R=golang-codereviews, dvyukov, khr CC=golang-codereviews https://golang.org/cl/54060043
Diffstat (limited to 'src/pkg/runtime/chan.c')
-rw-r--r--src/pkg/runtime/chan.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pkg/runtime/chan.c b/src/pkg/runtime/chan.c
index d90dc78e16..81a56488ae 100644
--- a/src/pkg/runtime/chan.c
+++ b/src/pkg/runtime/chan.c
@@ -159,6 +159,9 @@ runtime·chansend(ChanType *t, Hchan *c, byte *ep, bool *pres, void *pc)
G* gp;
int64 t0;
+ if(raceenabled)
+ runtime·racereadobjectpc(ep, t->elem, runtime·getcallerpc(&t), runtime·chansend);
+
if(c == nil) {
USED(t);
if(pres != nil) {
@@ -292,6 +295,8 @@ runtime·chanrecv(ChanType *t, Hchan* c, byte *ep, bool *selected, bool *receive
G *gp;
int64 t0;
+ // raceenabled: don't need to check ep, as it is always on the stack.
+
if(debug)
runtime·printf("chanrecv: chan=%p\n", c);