which async framework?

Ian Kelly ian.g.kelly at gmail.com
Wed Mar 12 05:58:50 EDT 2014


On Tue, Mar 11, 2014 at 5:38 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Wed, Mar 12, 2014 at 10:18 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
>> Chris Angelico <rosuav at gmail.com>:
>>
>>> What corner cases are there with threads that you don't have with
>>> anything else?
>>
>> There are numerous. Here's one example: deadlocks due to two threads
>> taking locks in a different order. The problem crops up naturally with
>> two intercommunicating classes. It can sometimes be very difficult to
>> spot or avoid.
>
> Yep. Now how is that not a problem when you use some other model, like
> an event loop? The standard methods of avoiding deadlocks (like
> acquiring locks in strict order) work exactly the same for all models,
> and are just as necessary.

If you don't have threads then the only locks you need to acquire are
for external resources.  You might still deadlock, but at least your
process won't be deadlocking with itself.



More information about the Python-list mailing list