> On 15 Jun 2019, at 10:55, Gustavo Carneiro <[email protected]> wrote:
>
>
> Perhaps. But using threads is more complicated. You have to worry about the
> integrity of your data in the face of concurrent threads. And if inside your
> task you sometimes need to call async coroutine code, again you need to be
> extra careful, you can't just call coroutines from threads directly.
I work on a large product that uses the twisted async framework.
And I can assure you the data integrity problem exists in async code as well.
At least in twisted it is easy enough to deferToThread() a background task that
once complete
will continue processing on the foreground thread, we do that for heavy file IO
tasks.
But we offload compute tasks to other processes as using threads in python does
not work
because of the GIL and we have to meet latency targets.
Barry
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/73U3X6I2WRDKUWCHMJ7NKRHOTRZ5XJRC/
Code of Conduct: http://python.org/psf/codeofconduct/