[zeromq-dev] Signal handling in blocking zmq_recv

David Robinson zxvdr.au at gmail.com
Tue Mar 9 00:48:41 CET 2010


On Mon, Mar 8, 2010 at 6:29 PM, Martin Sustrik <sustrik at 250bpm.com> wrote:
> Brian,
>
>> Do you have a sense of what a proper signal handler would do?
>
> I wasn't solving the problem myself. Mato Lucina will give you more
> proper info.
>
> However, AFAIU, Python (Ruby) should block all the signals on its
> thread(s) and create a separate thread to call sigwait occasionally to
> check for the signals.
>
> See the implemetation example here:
>
> http://github.com/mato/zeromq-examples/blob/master/zmq-camera.c

fwiw, in the zmq-camera example you can avoid creating a thread to
handle signals since you're using polling - you could use signalfd to
receive signals via a file descriptor, then have zmq poll the socket
and signal fd. Looks like signalfd is Linux specific thou...

-Dave



More information about the zeromq-dev mailing list