aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2011-03-25 10:36:22 -0700
committerIan Lance Taylor <iant@golang.org>2011-03-25 10:36:22 -0700
commit7c616b3809724874c15be762ab9dd15d9ee86406 (patch)
treefd887ec122ba08c4ee6fa6bfaa65a0defd5ac55b
parentf6d0e811796868d74c9a9030e4771e44fef76734 (diff)
downloadgo-7c616b3809724874c15be762ab9dd15d9ee86406.tar.gz
go-7c616b3809724874c15be762ab9dd15d9ee86406.zip
runtime: always set *received in chanrecv.
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
-rw-r--r--src/pkg/runtime/chan.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pkg/runtime/chan.c b/src/pkg/runtime/chan.c
index 9630c436f6..abb1b690dd 100644
--- a/src/pkg/runtime/chan.c
+++ b/src/pkg/runtime/chan.c
@@ -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