Using a background thread with asyncio/futures with flask
Frank Millman
frank at chagford.com
Sun Mar 24 03:34:06 EDT 2024
On 2024-03-23 3:25 PM, Frank Millman via Python-list wrote:
>
> It is not pretty! call_soon_threadsafe() is a loop function, but the
> loop is not accessible from a different thread. Therefore I include a
> reference to the loop in the message passed to in_queue, which in turn
> passes it to out_queue.
>
I found that you can retrieve the loop from the future using
future.get_loop(), so the above is not necessary.
Frank
More information about the Python-list
mailing list