mirror of
https://github.com/golang/go
synced 2024-11-22 02:44:39 -07:00
another try at clearing
channel recv data. R=rsc CC=golang-dev https://golang.org/cl/896041
This commit is contained in:
parent
dec248c665
commit
b57afc2f83
@ -781,10 +781,9 @@ loop:
|
|||||||
sel, c, cas, cas->send, o);
|
sel, c, cas, cas->send, o);
|
||||||
|
|
||||||
if(!cas->send) {
|
if(!cas->send) {
|
||||||
if(cas->u.elemp != nil) {
|
if(cas->u.elemp != nil)
|
||||||
c->elemalg->copy(c->elemsize, cas->u.elemp, sg->elem);
|
c->elemalg->copy(c->elemsize, cas->u.elemp, sg->elem);
|
||||||
c->elemalg->copy(c->elemsize, sg->elem, nil);
|
c->elemalg->copy(c->elemsize, sg->elem, nil);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
freesg(c, sg);
|
freesg(c, sg);
|
||||||
@ -792,10 +791,9 @@ loop:
|
|||||||
|
|
||||||
asyncrecv:
|
asyncrecv:
|
||||||
// can receive from buffer
|
// can receive from buffer
|
||||||
if(cas->u.elemp != nil) {
|
if(cas->u.elemp != nil)
|
||||||
c->elemalg->copy(c->elemsize, cas->u.elemp, c->recvdataq->elem);
|
c->elemalg->copy(c->elemsize, cas->u.elemp, c->recvdataq->elem);
|
||||||
c->elemalg->copy(c->elemsize, c->recvdataq->elem, nil);
|
c->elemalg->copy(c->elemsize, c->recvdataq->elem, nil);
|
||||||
}
|
|
||||||
c->recvdataq = c->recvdataq->link;
|
c->recvdataq = c->recvdataq->link;
|
||||||
c->qcount--;
|
c->qcount--;
|
||||||
sg = dequeue(&c->sendq, c);
|
sg = dequeue(&c->sendq, c);
|
||||||
@ -824,10 +822,9 @@ syncrecv:
|
|||||||
// can receive from sleeping sender (sg)
|
// can receive from sleeping sender (sg)
|
||||||
if(debug)
|
if(debug)
|
||||||
printf("syncrecv: sel=%p c=%p o=%d\n", sel, c, o);
|
printf("syncrecv: sel=%p c=%p o=%d\n", sel, c, o);
|
||||||
if(cas->u.elemp != nil) {
|
if(cas->u.elemp != nil)
|
||||||
c->elemalg->copy(c->elemsize, cas->u.elemp, sg->elem);
|
c->elemalg->copy(c->elemsize, cas->u.elemp, sg->elem);
|
||||||
c->elemalg->copy(c->elemsize, sg->elem, nil);
|
c->elemalg->copy(c->elemsize, sg->elem, nil);
|
||||||
}
|
|
||||||
gp = sg->g;
|
gp = sg->g;
|
||||||
gp->param = sg;
|
gp->param = sg;
|
||||||
ready(gp);
|
ready(gp);
|
||||||
|
Loading…
Reference in New Issue
Block a user