Why is multiprocessing.Queue creating a thread ?

Chris Angelico rosuav at gmail.com
Sun Jul 29 08:21:01 EDT 2018


On Sun, Jul 29, 2018 at 8:03 PM, Léo El Amri via Python-list
<python-list at python.org> wrote:
> Hello list,
>
> This is a simple question: I wonder what is the reason behind
> multiprocessing.Queue creating a thread to send objects through a
> multiprocessing.connection.Connection.
> I plan to implement an asyncio "aware" Connection class. And while
> reading the source code of the multiprocessing module, I found that (As
> outlined in the documentation) Queue is indeed creating a thread. I want
> to know if I'm missing something.

I'm not certain, but I suspect it's the simplest way to create a
non-blocking feeder. If you want to subclass it and replace that with
something that uses your event loop, go ahead; it might end up
becoming an additional subclass in the stdlib, alongside SimpleQueue
and JoinableQueue.

ChrisA



More information about the Python-list mailing list