Your program is most certainly non-deterministic, and you will sometimes
close a closed channel and panic. There is no thread safe way to test if a
channel is closed, then close it if it isn't.
I think of channel ownership in a similar way as of memory ownership in
C/C++. If this channel is being
Hello.
I apologize if my previous mail was cut unexpectedly short. My e-mail client
did something that I do not completely understand.
ISTM that there are no guarantees about the behavior of that program at all.
Access to c from niller and closer is not synchronized, so it's not really
possible t
Hello fellow Go devs,
I have a question that probably is a bit weird and obvious, but here we go
package main
var c chan int
func niller() {
c = nil
}
func closer() {
close(c)
}
func main() {
c = make(chan int, 1)
go closer()
go niller()
// checkpoint-1
if c != nil {
// checkpoint-2
close