The following scripts can be used to reproduce the ZMQEventLoop
(and the default SelectEventLoop
) in
urwid "hanging" when watched queues (or file descriptors) are ready but aren't serviced by their respective
handlers.
The zmq_send.py
and zmq_recv_1.py
scripts can be run together to demonstrate a simple urwid application
that receives messages from a SUB socket and displays them next to a clock. The zmq_recv_2.py
script
demonstrates what happens when the SUB socket is "ready" but isn't cleared by the handler; it's simply
called repeatedly in preference to anything else. The display doesn't update unless draw_screen()
is
explicitly called because by default this is only done in the idle handler, which never fires as long as
one queue or file descriptor is "ready".
Likewise sel_send.py
, sel_recv_1.py
, and sel_recv_2.py
demonstrate the same thing but with the default
SelectEventLoop
(unsurprisingly given I modelled ZMQEventLoop.loop
pretty closely on SelectEventLoop.loop
).
Please note in the case of the socket examples, the receiving end must be started first (ZMQ doesn't care).