mirror of
https://github.com/golang/go
synced 2024-11-20 05:04:43 -07:00
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
This commit is contained in:
parent
f6d0e81179
commit
7c616b3809
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user