[Stackless] Stackless and Pyrex efficiently

Péter Szabó ptspts+stackless at gmail.com
Mon Jan 25 22:26:43 CET 2010


Hi,

I'm planning to reimplement some of my Stackless I/O buffering +
read(2) + write(2) code in Pyrex. Is it possible to call
stackless.schedule_remove() from a Pyrex method (or a C extension
function)? Is it recommended? How should I make it work most
efficiently? Is there a recommended alternative?

I'd like to translate a function like this to Pyrex:

def Read(fd, size):
 while True:
   try:
     return os.read(fd, size)
   except OSError, e:
     if errno != errno.EAGAIN:
       raise
     my_event_loop.add_read(fd)
     stackless.schedule_remove()
     # The event loop tasklet will schedule us once there is data
     # to read from fd.

Thanks,

Péter




More information about the Stackless mailing list