[Stackless] Giving names for tasklets

Richard Tew richard.m.tew at gmail.com
Fri Jun 30 09:23:00 CEST 2006


On 6/29/06, Juho Mäkinen <juho.makinen at gmail.com> wrote:
> I'll check if I can reproduce it again easily and if I run onto it
> by misstake, I'll do all I can to create a simple testcase to reproduce it.

That would be appreciated :)

> At dumps() the "print t" prints correctly that t is a NamedTasklet,
> but at loads() the print t prints that it's a stackless.tasklet object.
> Where did the NamedTasklet go?

It doesn't look like pickling custom tasklet classes is supported
and tasklets are just pickled the same plain way.  Not sure what
is required to support them at this stage.  I'll add looking into it
to my growing list, unless you want to have a go yourself.

> Another thing is how I should pickle and unpickle a group of tasklets
> which communicate together with channels? Is it possible to pickle
> just one (for example ping() tasklet from the ping()-pong() example)
> tasklet, unpickle it later and except that everything works as expected?

When I was debugging a pickling problem Andrew Francis had, this
is how I believe it worked:

Pickling a tasklet blocked on a channel, where there is no reference
held to the channel, will result in that tasklet being pickled, blocked,
but not on the channel.  I do not believe this tasklet can be safely
resumed and when scheduled will crash (perhaps something
to do with the call stack where it blocked on the channel).

If you pickle the channel, or a something with enough of a
reference to the channel to get it pickled, then the channel and the
tasklets blocked on it are pickled.

So, if you want to pickle one tasklet and also get the channel it
is blocked on, and its blocked neighbours on the channel pickled
along with it, then you might want to do this instead of just
pickling the tasklet itself and hoping for the best.

  dumps(tasklet._channel)

Richard.

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



More information about the Stackless mailing list