[QGIS-Developer] asyncio in plugins?

Sebastian M. Ernst ernst at pleiszenburg.de
Tue Mar 23 13:06:44 PDT 2021


Hi David,

I suspected this much. In theory, I can move the event loop into a
separate thread [1, 2] - this should allow QGIS' event loop to continue
running and accepting input etc. I am *guessing* that this can be made
work. Question: Has someone around here actually tried it before?

Best regards,
Sebastian


1: https://gist.github.com/lars-tiede/01e5f5a551f29a5f300e
2:
https://docs.python.org/3/library/asyncio-eventloop.html#executing-code-in-thread-or-process-pools


Am 23.03.21 um 20:47 schrieb David Marteau:
> Hi,
> 
> Asynchronous python code with asyncio assume that you have an ioloop
> running in a blocking way in your python code:
> that means that no other code (in the same thread) cannot run
> concurrently with your async tasks while your loop is running.
> 
> David
> 


More information about the QGIS-Developer mailing list