Tim Peters added the comment:
I think this is expected. Add this as the first line of `simulate()` and the
problem should go away:
q.cancel_join_thread()
As the docs say, a Queue works with a background thread, which feeds incoming
data from an internal buffer to a (interprocess) pipe. By default, a process
using the Queue attempts to join that thread when the process exits. But since
you never take anything off the queue, the thread waits forever, hoping for the
pipe to drain so it can feed in the rest of its buffer.
But see the docs for why you don't really want to use .cancel_join_thread():
the process will just exit then, and the data in the internal buffer will most
likely simply be lost.
A Manager.Queue doesn't have this problem because it runs in its own (Manager)
process: q.put() sends the data to that process at once, without buffering
anything. So if you have write-only Queues, that's the way to go ;-)
----------
nosy: +tim.peters
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29797>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com