Sujet : Re: Using a background thread with asyncio/futures with flask
De : frank (at) *nospam* chagford.com (Frank Millman)
Groupes : comp.lang.pythonDate : 24. Mar 2024, 09:34:06
Autres entêtes
Message-ID : <mailman.20.1711265804.3468.python-list@python.org>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
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