multithreading - In Go what happens if you write to closed channel? Can I treat channels as deterministic RE destruction? -
okay warning me subjective title please let me explain. right i'm looking @ go, i've read spec, watched few io talks, looks interesting have questions. one of favourite examples select statement listened channel came "doafter()" or something, channel send @ given time now. something (this wont work, pseudo-go if anything!) to := time.doafter(1000 * time.ms) select: case <-to: return nil //we timed out case d := <-waitingfor: return d suppose thing we're waiting happens fast, function returns , isn't listening to more, happens in doafter? i , know ought not test channel, example if(chantosendtimeouton.isopen()) { chantosendtimeouton<-true } i how channels sync places, example possible function above return after isopen() test before sending of true. against test, avoids channels - hide locks , whatnot. i've read spec , seen run time panics , recovery, in example recover? thing waiting send timeout ...