[Stackless] Blocked Tasklets

Benjamin Buco fiatetdeusetlux at yahoo.com
Tue Nov 29 02:50:30 CET 2005


Well, I found stackless a few weeks ago and its helping out a great deal so far.  However I seem to be a bit confused about when a channel unblocks a tasklet.  For some reason I thought that a tasklet blocked while waiting on a channel and then immediatly began to run itself again after being unblocked.  Here's my code, its pretty obvious what I want it do do, but these are the results I get:
   
  0
Sending 0
getting 0
-1
-1
   
  Any help would be greatly appreciated.
  Thanks,
  Benjamin Buco
   
  Code Follows
   
  def Test():
    def Move(movechan):
        for n in range(13):
            print "Sending %r" % (n)
            movechan.send(n)
      def Move2(movechan2):
        x=0
        while x<>14:
            x = movechan2.receive()
            print "getting %r" % (x)
      ch2=stackless.channel()
    print ch2.balance
    a2=stackless.tasklet(Move)(ch2)
    a2.run()
    a2=stackless.tasklet(Move2)(ch2)
    a2.run()
    print ch2.balance
    x=0
    print ch2.balance
  Test()

		
---------------------------------
 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20051128/1475231c/attachment.htm>
-------------- next part --------------
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless


More information about the Stackless mailing list