[zeromq-dev] Signal handling in blocking zmq_recv

Martin Sustrik sustrik at 250bpm.com
Tue Mar 9 19:57:09 CET 2010

Martin Lucina wrote:
> chris at chriswongstudio.com said:
>> Martin, thanks for the pointer to the zmq-camera example.  It handles SIGINT/SIGQUIT etc by exiting the process.  If I want to interrupt all the blocked zmq_recv calls when receiving a SIGINT, how would you suggest me approaching this problem?  zmq_recv seems to be blocked forever.
> You can't do that (interrupt all blocking calls) right now without killing
> the thread, or somehow signalling (e.g. via yet another inproc socket) to
> tell it to go away. This is why zmq-camera does not try to do anything
> better than exit().
> Martin, I almost forgot, weren't we going to either change the default
> behaviour of zmq_term() or add a flag to say "Please go away NOW!"?

Yes. Sane termination of blocking calls in case of zmq_term is in the 

The idea is that once you call zmq_term on the context, all blocking 
calls withing the context will exit with specific error code (ESHUTDOWN 
or similar).


More information about the zeromq-dev mailing list