mirror of
https://github.com/golang/go
synced 2024-11-22 00:24:41 -07:00
parent
585eae3bce
commit
3f19d8ae8d
@ -68,8 +68,6 @@ typecheckselect(Node *sel)
|
|||||||
typechecklist(ncase->nbody, Etop);
|
typechecklist(ncase->nbody, Etop);
|
||||||
}
|
}
|
||||||
sel->xoffset = count;
|
sel->xoffset = count;
|
||||||
if(count == 0)
|
|
||||||
yyerror("empty select");
|
|
||||||
lineno = lno;
|
lineno = lno;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +89,7 @@ walkselect(Node *sel)
|
|||||||
typecheck(&r, Etop);
|
typecheck(&r, Etop);
|
||||||
init = list(init, r);
|
init = list(init, r);
|
||||||
|
|
||||||
if(sel->list == nil)
|
if(sel->list == nil && sel->xoffset != 0)
|
||||||
fatal("double walkselect"); // already rewrote
|
fatal("double walkselect"); // already rewrote
|
||||||
|
|
||||||
// register cases
|
// register cases
|
||||||
|
@ -631,9 +631,11 @@ void
|
|||||||
printf("select: sel=%p\n", sel);
|
printf("select: sel=%p\n", sel);
|
||||||
|
|
||||||
if(sel->ncase < 2) {
|
if(sel->ncase < 2) {
|
||||||
if(sel->ncase < 1)
|
if(sel->ncase < 1) {
|
||||||
throw("select: no cases");
|
g->status = Gwaiting; // forever
|
||||||
// make special case of one.
|
gosched();
|
||||||
|
}
|
||||||
|
// TODO: make special case of one.
|
||||||
}
|
}
|
||||||
|
|
||||||
// select a (relative) prime
|
// select a (relative) prime
|
||||||
|
@ -112,13 +112,9 @@ func main() {
|
|||||||
<-ch
|
<-ch
|
||||||
})
|
})
|
||||||
|
|
||||||
// TODO(gri) remove this if once 6g accepts empty selects
|
|
||||||
enabled := false
|
|
||||||
if enabled {
|
|
||||||
// empty selects always block
|
// empty selects always block
|
||||||
testBlock(always, func() {
|
testBlock(always, func() {
|
||||||
select {
|
select {
|
||||||
case <-make(chan int): // remove this once 6g accepts empty selects
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -143,7 +139,6 @@ func main() {
|
|||||||
unreachable()
|
unreachable()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
// selects with non-ready non-nil channels always block
|
// selects with non-ready non-nil channels always block
|
||||||
testBlock(always, func() {
|
testBlock(always, func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user