[Python-Dev] async IO and helper threads

Antoine Pitrou solipsis at pitrou.net
Sun Oct 9 21:02:16 CEST 2005

Le dimanche 09 octobre 2005 à 07:46 -0700, Guido van Rossum a écrit :
> I
> also think that using a thread for async I/O is the wrong approach --
> if you wanted to use threads shou should be using threads and you
> wouldn't be dealing with generators. There's a solution that uses
> select() which can handle as many sockets as you want without threads
> and without the clumsy polling

select() works with sockets. But nothing else if you want to stay
cross-platform, so async file IO and other things remain open questions.
By the way, you don't need clumsy polling to wait for helper threads ;)
You can just use a ConditionVariable from the threading package (or
something else with the same semantics).

BTW, I'm not arguing at all for the extension proposal. Integrating
async stuff into generators does not need an API extension IMO. I'm
already doing it in my scheduler.
An example which just waits for an external command to finish and
periodically spins a character in the meantime:
The scheduler code is here:



More information about the Python-Dev mailing list