[Python-ideas] An alternate approach to async IO

Richard Oudkerk shibturn at gmail.com
Wed Nov 28 20:57:29 CET 2012

On 28/11/2012 7:23pm, Trent Nelson wrote:
>      Oooer, that's definitely not what I had in mind.  This is how I
>      envisioned it working (think of events() as similar to poll()):
>          with aio.events() as events:
>              for event in events:
>                  # process event
>                  ...
>      That aio.events() call would result in an InterlockedSListFlush,
>      returning the entire list of available events.  It then does the
>      conversion into a CPython event type, bundles everything into a
>      list, then returns.
>      (In reality, there'd be a bit more glue to handle an empty list
>       a bit more gracefully, and probably a timeout to aio.events().
>       Nothing should involve a spinlock though.)
>          Trent.

That api is fairly similar to what is in the proactor branch of tulip 
where you can write

     for event in proactor.poll(timeout):
         # process event

But why use a use a thread pool just to take items from one thread safe 
(FIFO) queue and put them onto another thread safe (LIFO) queue?


More information about the Python-ideas mailing list