which async framework?

Chris Angelico rosuav at gmail.com
Tue Mar 11 18:38:33 EDT 2014


On Wed, Mar 12, 2014 at 9:28 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> If you can't write your own event loop, you probably can't be trusted
> with any multithreaded code, which has much more baffling corner cases.

I'm not sure about that. Threads are generally easier to handle,
because each one just does something on its own, sequentially. (The
problem with threads is the resource usage - you need to allocate X
amount of stack space and other execution state, when all you really
need is the socket (or whatever) and some basic state about that.)
Regardless of how you structure your code, you have to ensure that one
handler doesn't tread on another's toes, and with multithreading,
that's _all_ you have to worry about. A proper event loop, handling
events from all sorts of different sources, is far more complicated.

What corner cases are there with threads that you don't have with anything else?

ChrisA



More information about the Python-list mailing list