Commit abd588aa authored by Keith Randall's avatar Keith Randall Committed by Dmitriy Vyukov

runtime: fix race detector by recording read by chansend.

R=golang-codereviews, dvyukov, khr
CC=golang-codereviews
https://golang.org/cl/54060043
parent d5a36cd6
...@@ -159,6 +159,9 @@ runtime·chansend(ChanType *t, Hchan *c, byte *ep, bool *pres, void *pc) ...@@ -159,6 +159,9 @@ runtime·chansend(ChanType *t, Hchan *c, byte *ep, bool *pres, void *pc)
G* gp; G* gp;
int64 t0; int64 t0;
if(raceenabled)
runtime·racereadobjectpc(ep, t->elem, runtime·getcallerpc(&t), runtime·chansend);
if(c == nil) { if(c == nil) {
USED(t); USED(t);
if(pres != nil) { if(pres != nil) {
...@@ -292,6 +295,8 @@ runtime·chanrecv(ChanType *t, Hchan* c, byte *ep, bool *selected, bool *receive ...@@ -292,6 +295,8 @@ runtime·chanrecv(ChanType *t, Hchan* c, byte *ep, bool *selected, bool *receive
G *gp; G *gp;
int64 t0; int64 t0;
// raceenabled: don't need to check ep, as it is always on the stack.
if(debug) if(debug)
runtime·printf("chanrecv: chan=%p\n", c); runtime·printf("chanrecv: chan=%p\n", c);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment