I'm writing a wrapper around go.wde (which uses xgb as a backend) and can't seem to find a good way to close down the X connection. When attempting to close a window go.wde gets hung up in WaitForEvent() since no new events are coming down the channel.
The receive operation in WaitForEvent() could complete if eventChan were to be closed, which requires breaking out of the infinite loop in ReadResponses(). My first attempt was to call the connection's Close() method to prevent the io.ReadFull() call from blocking but that generates the following messy error:
XGB: log.go:29: Read error: read unix /tmp/.X11-unix/X0: use of closed network connection.
So, what's the right way to shut down a connection and allow the xgb goroutines to close their channels and return gracefully?
I'm writing a wrapper around go.wde (which uses xgb as a backend) and can't seem to find a good way to close down the X connection. When attempting to close a window go.wde gets hung up in WaitForEvent() since no new events are coming down the channel.
The receive operation in WaitForEvent() could complete if eventChan were to be closed, which requires breaking out of the infinite loop in ReadResponses(). My first attempt was to call the connection's Close() method to prevent the io.ReadFull() call from blocking but that generates the following messy error: XGB: log.go:29: Read error: read unix /tmp/.X11-unix/X0: use of closed network connection.
So, what's the right way to shut down a connection and allow the xgb goroutines to close their channels and return gracefully?