[Stackless] Re: [Python-Dev] Tcl adept wanted for Stackless problem

Jeff Senn senn at maya.com
Wed Jun 19 19:12:07 CEST 2002

Christian Tismer <tismer at tismer.com> writes:
> The remaining problem is switching of tasklets which contain
> Tcl invocations. I thought so far that this is no problem,
> since these are disjoint contexts, but Jeff Senn reported
> problems as well.
> I fear I have the problem that Tcl thinks it is still using
> the same interp, or it creates a nested one, while the
> tasklets are not nested, but seen as independent. Somehow
> I need to create a new Tcl frame chain for every tasklet
> that uses Tcl.
> Can this be the problem?

I don't think that is *my* problem since I'm pretty sure when I 
restrict the tasklets so as not to do any Tkinter calls, that
doesn't help.

It seems that there may be a problem merely with Stackless and native

Included below is a test that crashes merely by running tasklets in 2
threads. (Slicing is disabled I believe.)


#run tasklets in 2 threads with auto-scheduling on...
import thread,stackless
def dosome(x):
  stackless.autoschedule_lock(0) #enable auto scheduling
  print thread.get_ident(), "Start",x
  j = 0
  for i in range(1,x):
    j = j + 1
  print "Done",x
def uthread(x): x()

def test():
  stackless.autoschedule_lock(0) #enable auto scheduling
  print thread.get_ident(),"add1"
  uthread_gen(lambda x=300000: dosome(x)).run()
  print thread.get_ident(),"add2"
  uthread_gen(lambda x=3001: dosome(x)).run()
  print thread.get_ident(),"add3"
  uthread_gen(lambda x=4003: dosome(x)).run()
  print thread.get_ident(),"add4"
  uthread_gen(lambda x=3002: dosome(x)).run()

print "all done"

More information about the Stackless mailing list