[zeromq-dev] pyzmq poller and EINTR

Martin.Belanger at dell.com Martin.Belanger at dell.com
Wed Jan 16 14:17:13 CET 2019


?Thanks. That's a good workaround. I can send the signal from the signal handler. -Martin

________________________________
From: zeromq-dev <zeromq-dev-bounces at lists.zeromq.org> on behalf of Doron Somech <somdoron at gmail.com>
Sent: Wednesday, January 16, 2019 03:14
To: ZeroMQ development list
Subject: Re: [zeromq-dev] pyzmq poller and EINTR


[EXTERNAL EMAIL]

Add another socket to the zmq_poll, which is a pair, just for signalling the poll to stop.
When you want to stop it, send a signal from the paired socket, which you can do from another thread.

On Tue, Jan 15, 2019 at 5:50 PM <Martin.Belanger at dell.com<mailto:Martin.Belanger at dell.com>> wrote:
The C library provides zmq_poll(), which returns -1 on error and set the errno accordingly. I'm particularly interested by errno=EINTR, which means: "The operation was interrupted by delivery of a signal before any events were available."

Now if we look at the Python code there is zmq.Poller.poll(timeout=None). This functions returns the list of events that are ready to be processed. There is no mention of how zmq.Poller.poll() behaves when a signal is received. In fact, I did a test and it seems that zmq.Poller.poll() simply cannot be interrupted. I need to implement a loop that is waiting forever on a couple of sockets. However, I want to be able to send a signal (HANGUP) to that process to tell it to stop polling and reload its configuration. Please let me know how I can do this.

Thanks.
_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org<mailto:zeromq-dev at lists.zeromq.org>
https://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20190116/ccfb5c46/attachment.htm>


More information about the zeromq-dev mailing list