[Stackless] Question about channels

Stephan Diehl stephan.diehl at gmx.net
Thu Oct 17 10:46:18 CEST 2002

> > ...
> > Lets say, I'd like to model a node as a tasklet that listens on two
> > (virtual) network cards. For every network card (or probably better: for
> > every IP address) I'd take a pair of channels, listen to the receiving
> > ones and take appropriate routing action on the received data. In order
> > to do that, the channels have to be nonblocking.
> > I'd just like to make my model as primitive as possible.
> >
> > But then, maybe my question shows that I really don't know what I'm
> > talking about.
> This would in fact be my first choice, but it requires an alt statement.
> The problem is you have n channels and you want to wait
> for input over any one of them.  Non-blocking channel operations
> don't get you anything here, since you'd have to busy loop
> waiting for them.

That makes an awfull lot of sense.

> What you could do instead is make a tasklet for each interface
> and have it just read packets from the interface channel and send
> the pair (packet, interface-channel) to the per-node channel.
> Then the interesting node loop reads the per-node channel
> which tells it both the packet and which channel the packet
> came from.  This simulates the alt, more or less.

Thinking about it some more, the one channel approach might be best after all:
One tasklet per node and one tasklet per "network". Both kind of objects have 
one channel they read from and several channels they write to. Depending on 
the "destination address", the packet will be dispatched to the  right 
Thanks a lot for all the help.

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

More information about the Stackless mailing list