[Stackless] One-way channel pairs

Christian Tismer tismer at stackless.com
Sun Feb 8 08:13:25 CET 2004


Oren Tirosh wrote:
> Attached is a little module that defines the channel2() function. It is
> similar to the os.pipe() function, returning a 2-tuple of a receive-only 
> channel and a send-only channel. This can help in debugging because the
> receive-only side will raise an exception instead of blocking when there 
> are no more references to the sending side and vice versa.
> 
> With the standard channel it is impossible because you can't tell whether
> a tasklet is holding a reference to a channel for sending or receiving 
> purposes.

This is fine with me, since it reads like something
that really can be built upon the channel model
which is about to being built.

...

> class channel(stackless.channel):
>     """ This channel subclass implements the Python Iterator protocol and
>     a close method. These extensions have been discussed on the stackless
>     list and, if I understand correctly, are going to be incorporated into
>     stackless. """

You did!

...

>     def close(self):
>         """ The real implementation should also prevent further writing
>         to the channel and ensure that StopIteration will be raised for
>         all receivers, not just one! """
>         if self.queue:
>             self.send_exception(StopIteration)

It will!

> class receive_only_channel:
...

> class send_only_channel:
...

Do you think it would make sense to make these into the
basic channel implementations, or do you think we should
keep the current ones (with extension) and build your's
upon them?

Do you think efficiency would be reasonably better?

Do you think the C implementation could get simpler?

If so, I'd like to try it!

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  mobile +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/



_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list