[Stackless] non-blocking IO in uthreads

Bernd Rinn Bernd.Rinn at epost.de
Fri Feb 9 16:36:12 CET 2001

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:

def nbselect(iwtd, owtd, ewtd, timeout=-1):
    from select import select
    from time import time
    dt = 0.005
    tmax = time() + timeout
    r,w,e = select(iwtd, owtd, ewtd, dt)
    while timeout < 0 or time() < tmax:
        r,w,e = select(iwtd, owtd, ewtd, dt)
        if r or w or e: break
    return r,w,e

* If the above is the way to go: What should I use for 'dt'? The above
  version eats about 2-3% of the CPU of a PentiumIII-700Mhz (which is
  a lot for a select() operation in my opinion).

Any comment is appreciated, thanks in advance.

Best regards,


P.S.: Please CC answers to Bernd.Rinn at uni-konstanz.de, since I am not
      subscribed to the list.

Bernd Rinn
Fakultät für Physik
Universität Konstanz

Tel. 07531/88-3812, 
e-mail: Bernd.Rinn at uni-konstanz.de
PGP-Fingerprint: 1F AC 31 64 FF EF A9 67  6E 0D 4C 26 0B E7 ED 5C
Stackless mailing list
Stackless at starship.python.net

More information about the Stackless mailing list