[Stackless] Problems with removing tasklet.

Jeff Senn stackless-python at maya.com
Thu Oct 10 16:56:51 CEST 2002


Also here is a pure-python version that uses the .run that is already
in the stackless module.  It is much slower since it is in python -- and
each interrupt has to switch back to the main tasklet only so that it
can then switch to the next tasklet...  Also if you happen to interrupt
someone who was atomic then you have to (painfully) rotate through the whole
queue of tasklets to make the atomic one "next" again...

-- 
-Jas

--snip--
  FREE_SCHEDULE_INTERVAL = 5 #what is a good value?
  def freesched():
    r = stackless.run
    m = stackless.getcurrent()
    while 1:
      v = r(FREE_SCHEDULE_INTERVAL)
      if v == None: 
          break
      else:
        v.insert()
        if v.atomic: 
          while m.next != v:
            x = m.next
            x.remove()
            x.insert()

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



More information about the Stackless mailing list