Remix.run Logo
xg15 2 days ago

Everything that directly interacts with an event loop object and calls methods such as loop.call_soon() [1].

This is used by most of asyncio's synchronization primitives, e.g. async.Queue.

A consequence is that you cannot use asyncio Queues to pass messages or work items between async functions and worker threads. (And of course you can't use regular blocking queues either, because they would block).

The only solution is to build your own ad-hoc system using loop.call_soon_threadsafe() or use third-party libs like Janus[2].

[1] https://github.com/python/cpython/blob/e4e2390a64593b33d6556...

[2] https://github.com/aio-libs/janus