[Stackless] non-blocking IO in uthreads

Jeff Senn senn at maya.com
Fri Feb 9 17:46:55 CET 2001

Bernd Rinn <Bernd.Rinn at epost.de> writes:
> Hi everyone,
> since I have just started with stackless-python and microthreads, my
> questions are pretty basic:
> * I there a module for doing non-blocking IO in uthreads?
> * If not, do you know a better way to do it than the following:

Hey! I just wrote essentially the same code yesterday.  However in my
version I provided a call that blocked the current thread and used a
single uthread to gather up all of the selects and then unblock'd any
uthreads found to have IO ready.  It's probably a better solution
if your program is going to have a lot of IO pending -- since the
various uthreads calling select don't have to fight it out.  (I've
done no performance tests...yet).

Also I did the select with a immediate timeout and then did a
uthread.wait(...)  -- which is probably better if you have a lot of
non-IO blocked uthreads running that you don't want to postpone.

-Jas   --------------------     www.maya.com
       Jeff Senn          |   / / |-/ \ / /|
       Chief Technologist |  /|/| |/ o | /-|
       Head of R&D        | Taming Complexity

Stackless mailing list
Stackless at starship.python.net

More information about the Stackless mailing list