[Stackless] Why would a channel stop listening?

Simon Pickles sipickles at hotmail.com
Thu Jan 31 21:34:06 CET 2008


Hello,

I have been getting along well with stackless until now.

I've got an application which makes heavy use of events thru stackless 
channels. Its based on the Killer Robots example, where everything in 
the app is an actor.

Each actor has an rx stackless channel and I am running the receive for 
this channel in a tasklet:

class Actor:
    def __init__(self, ch, logFunction):
        self.rx = ch
        self.logger = logFunction
        self.processMessageMethod = self.MessageHandler
        self.logger("rx: %s" % self.rx)
        stackless.tasklet(self.ProcessMessage)()

    def ProcessMessage(self):
        while 1:
            self.logger("...... waiting for event message ......")
            self.processMessageMethod(self.rx.receive())

    def MessageHandler(self,args):
        self.logger("ERROR - Unhandled Message: %s" % args)

This has worked well until now. Suddenly several actor objects seem to 
be unresponsive to sent messages. Logging has shown me the sending 
object is using the receiving channel, but both sender and receiver seem 
to be blocked, like a race condition.

Can anyone suggest a reason why this might be? I am confused, since I 
thought running ProcessMessage in a tasklet would mean an object could 
listen and send 'almost' simultaneously?

Thanks

Simon

-- 
Linux user #458601 - http://counter.li.org.







More information about the Stackless mailing list