What is the purpose of the second nested <-done case in the code snippet 
below?
Wouldn't the first <-done case handle the cancellation?


orDone := func(done, c <-chan interface{}) <-chan interface{} {
valStream := make(chan interface{})
go func() {
defer close(valStream)
for {
select {
case <-done:           // first <-done case
return
case v, ok := <-c:
if ok == false {
return
}
select {
case valStream <- v:
case <-done:   // why the second nested <-done case?
}
}
}
}

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to