// signalOnce once that a channel is closed. This isn't multiple goroutines safe as most of channels are only closed
// by one goroutine (contrary to the quit one above)
signalOnce once that a channel is closed. This isn't multiple goroutines safe as most of channels are only closed
by one goroutine (contrary to the quit one above)
// signalOnce once that a channel is closed . This isn ' t multiple goroutines safe as most of channels are only closed // by one goroutine ( contrary to the quit one above )
func signalOnce(c chan struct{}) {
	select {
	case _, opened := <-c:
		if opened {
			close(c)
		}
	default:
		close(c)
	}
}
func signalOnce ( c chan struct { } ) { select { case _ , opened := <- c : if opened { close ( c ) } default : close ( c ) } }
signalOnce once that a channel is closed.
signalOnce once that a channel is closed .
// non blocking: either closed or receiving data // close it if it was opened // if c is opened a blocks (waiting for something)