You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to change our event-loop integration with Trio's guest mode. Trio's guest mode also works on asyncio thanks to aioguest. For it to work, we just need to have a function that can schedule a callback in the host event-loop in a thread-safe way.
in asyncio, that would be loop.call_soon_threadsafe(callback),
I did some experiments with Qt, it works fine on asyncio and Trio. And the nice thing is that there is no polling involved, as in our current solution.
For asyncio one could argue that aioguest uses greenlet, which manipulates the C stack, but on the other hand SQLAlchemy's whole async architecture is based on greenlet. PyPy also supports greenlet.
I would like to change our event-loop integration with Trio's guest mode. Trio's guest mode also works on asyncio thanks to aioguest. For it to work, we just need to have a function that can schedule a callback in the host event-loop in a thread-safe way.
loop.call_soon_threadsafe(callback)
,tk.after(0, callback)
.For instance, here is how it looks like when the host event-loop is tkinter's:
Before calling
tk.mainloop()
, we callstart_guest_run()
which runsfoo
as a task in tkinter's event-loop.Thoughts?
The text was updated successfully, but these errors were encountered: