[Stackless] Select() on channels?

Tim Kientzle tim at metaweb.com
Fri Sep 14 18:34:29 CEST 2007


Is there any way to wait on a set of channels
for the first one to become available?

I have an application where it would be
tremendously helpful to be able to receive()
on a set of channels at once.

If there's not already a mechanism, I would
propose something like:

   stackless.channel.multireceive(ch1, ch2, ...)

which returns a (channel, value) pair providing
the channel that had data and the value from
that channel.  (Returning a pair eliminates the
double-dip problem that the Unix select() system
call suffers from.)

The more general case of waiting for any set
of receive and/or send channels is of lesser
interest to me because the
     stackless.tasklet(ch.send)(value)
idiom for delayed sending covers a lot of
use cases.

Tim Kientzle




More information about the Stackless mailing list