osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Benefits of asyncio


In article <87ha42uos2.fsf at elektro.pacujo.net>,
 Marko Rauhamaa <marko at pacujo.net> wrote:

> Chris Angelico <rosuav at gmail.com>:
> 
> > I don't see how Marko's assertion that event-driven asynchronous
> > programming is a breath of fresh air compared with multithreading. The
> > only way multithreading can possibly be more complicated is that
> > preemption can occur anywhere - and that's exactly one of the big
> > flaws in async work, if you don't do your job properly.
> 
> Say you have a thread blocking on socket.accept(). Another thread
> receives the management command to shut the server down. How do you tell
> the socket.accept() thread to abort and exit?

You do the accept() in a daemon thread?