Open clawconduce opened 8 years ago
I am not sure how to do this. Perhaps something that sends the signal back to Go. I will have to look into this.
At the moment C-code and Go-code each have there separate signal handling. See: https://github.com/pebbe/zmq4/blob/master/examples/interrupt.go
I have done some tests, and it seems that with newer versions of Go (I am using version 1.6.2), setting a signal handler in Go also catches the signals in the C code. In example interrupts
, pressing control C when the program is waiting on client.Recv
doesn not interrupt the program, you get your output from ZeroMQ, and after that the signal is caught by the Go code.
@clawconduce:
The http://zguide.zeromq.org/page:all#Handling-Interrupt-Signals link shows how you can catch a signal in your code. It does not state whether the libzmq catches signals.
You'll have to search http://api.zeromq.org/ to find a function that disables signals and request @pebbe to add a go func.
Here is how go interacts with cgo (libzmq) https://godoc.org/os/signal.
I'd like to be able to disable 0mq's signal handling and only use Go's signal handling. It sounds like this might be possible based on http://zguide.zeromq.org/page:all#Handling-Interrupt-Signals
This would make writing code that handles signals much easier since I wouldn't have to check if I got EINTR errors everywhere.