[zeromq-dev] Poll on sockets OR child process

Michel Pelletier pelletier.michel at gmail.com
Sun Dec 22 02:58:08 CET 2013


On Fri, Dec 20, 2013 at 1:06 AM, Michael Haberler <mail17 at mah.priv.at>wrote:

>
> Am 20.12.2013 um 00:56 schrieb Michel Pelletier <
> pelletier.michel at gmail.com>:
>
> > So in (pyczmq) code I was thinking something like:
> >
> >
> > @zloop.signal_callback
> > def on_signal_event(loop, item, arg):
> > ...
> >
> >
> > loop = zloop.new()
> > zloop.signal(loop, signal.SIGHUP, on_signal_event)
>
> the issue I see: this is still the 'spontaneous invocation' handler model
> - meaning asynchronous delivery; you arm it, this fires whenever it feels
> fit
>
> I think the major upside with using signalfd in the loop is having control
> over when the handler is invoked, by treating signals like any other fd
> event and deal with them synchronously
>

I'm confused.  What you're describing is what I'm proposing.  I'm not
proposing using a traditional asynchronous signal handler that could
interrupt your program at any point, but for the above pseudocode to
register a file descriptor from signalfd with the zloop poller, and when
the loop is running, for the function to be called when the descriptor is
ready.  This seems to me to be entirely the point of signalfd.

-Michel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131221/0e4f15a3/attachment.htm>


More information about the zeromq-dev mailing list