[zeromq-dev] Signal handling in blocking zmq_recv

Brian Granger ellisonbg at gmail.com
Wed Mar 10 23:04:58 CET 2010


On Wed, Mar 10, 2010 at 1:52 PM, Martin Lucina <mato at kotelna.sk> wrote:
> Brian,
> ellisonbg at gmail.com said:
>> At that point, Python raised KeyboardError (the default sig handler
>> raises that for ctrl-C).  This simple experiment show that:
>> 1. Python's signal handler is still installed and working properly.
>> 2. When blocking on zmq_recv, the Python interpreter is "not in
>> control." (the 0MQ C++ code is running) and thus can't respond to the
>> signal until it gets control.
>> Thus, I think the only way of resolving this if 0MQ is making out
>> signals in the IO threads.  Thoughts?
> What you're saying is that the Python signal handler receives the signal,
> queues some kind of internal flag indicating "a signal was received" but
> doesn't actually *act on* the signal until the 0MQ C++ code returns to the
> Python binding, and the Python binding returns control to the Python
> interpreter.
> Do I understand you correctly?

Yes, that is my understanding of what Python is doing.



> -mato

Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu
ellisonbg at gmail.com

More information about the zeromq-dev mailing list