[Stackless] Access to local variables of a task from tasklet

Najem Karim najemkarim at yahoo.com
Thu Jun 18 09:49:56 CEST 2009


I have the following question:
Is there a way to access the local variables
of a tasklet.

I will explain with an example:

I have a task say:

def myTask1()
	localvar1 = 10

I use it to create a tasklet say:
myTasklet1 = stackless.tasklet(myTask1)()

then run it with:
myTasklet1 = stackless.run(1)
to run one instruction and return.

Is possible now to use myTasklet1 to check/get the value of localvar1

I need this because at this point I would like to run another task which
needs the current value localvar1 as input parameter

def myTask2(var1)

Now get the value of localvar1 from myTasklet1 and store it in var1
then remove myTasklet1 from the list using:

then create and run the second tasklet untill the end using:
myTasklet2 = stackless.tasklet(myTask2)(var1)

Once myTasklet2 is done, I resume myTasklet1 were it stopped before using
myTasklet1 = stackless.run(1)

then repeat allover again until myTasklet1 is finished

Is there a way to do this.

I appreciate any help.



More information about the Stackless mailing list