Two goroutines are using the same unbuffered channel.

One sends on it inside a select with a default clause.
The other receives from it inside a select with a default clause.

goroutine 1:
for {
    select {
    case obj <- ch:
    default:
    }
    ....
}

goroutine 2:
for {
    select {
    case ch <- obj:
    default:
    }
    ....
}

The channel is unbuffered.

Can these two goroutines ever communicate with each other?
It's a difficult thing to test if they never meet except once in a billion 
attempts.

I've looked at runtime/chan.go but I'm not sure if this depends on what the 
compiler generates for those select statements.

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/4edf84b4-0031-4470-a4a5-79869d4db567n%40googlegroups.com.

Reply via email to