]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: always set *received in chanrecv.
authorIan Lance Taylor <iant@golang.org>
Fri, 25 Mar 2011 17:36:22 +0000 (10:36 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 25 Mar 2011 17:36:22 +0000 (10:36 -0700)
Also fix comment.

The only caller of chanrecv initializes the value to false, so
this patch makes no difference at present.  But it seems like
the right thing to do.

R=rsc
CC=golang-dev
https://golang.org/cl/4312053

src/pkg/runtime/chan.c

index 9630c436f6831ad5c6da6fbc051a64575a36e570..abb1b690ddbe5928f8b5b88665e347c269fd1439 100644 (file)
@@ -366,6 +366,8 @@ asynch:
                if(selected != nil) {
                        runtime·unlock(c);
                        *selected = false;
+                       if(received != nil)
+                               *received = false;
                        return;
                }
                sg = allocsg(c);
@@ -521,7 +523,7 @@ runtime·selectnbrecv(byte *v, Hchan *c, bool selected)
 // compiler implements
 //
 //     select {
-//     case v = <-c:
+//     case v, ok = <-c:
 //             ... foo
 //     default:
 //             ... bar
@@ -529,7 +531,7 @@ runtime·selectnbrecv(byte *v, Hchan *c, bool selected)
 //
 // as
 //
-//     if c != nil && selectnbrecv(&v, c) {
+//     if c != nil && selectnbrecv2(&v, &ok, c) {
 //             ... foo
 //     } else {
 //             ... bar