[Stackless] You cannot __reduce__ the tasklet ...

Christian Tismer tismer at stackless.com
Wed Jun 2 23:41:23 CEST 2004


Arman Bostani wrote:
...
> In our version of thread pickling, we have a capture() call which
> pickles all frames up to the "capture" frame.  e.g.
> 
> def f():
>    res = capture()
>    if res:
>     print 'captured', res
>     # save res somewhere
>    else:
>     print 'unleashed'
> 
> capture() returns the pickled thread so it can be saved somewhere.
> When res is unpickled (unleashed), the new thread behaves as if
> capture() just returned with result 0.
> 
> I wonder if something like this is feasible with tasklets and the
> __reduce__ call?

So capture is a little like "pickling myself" upto a given frame.
I'm not too convinced that this is a general approach.
Maybe it would make sense to create a new tasklet in case of myself,
jump to it, let it do the pickle, and return with the value?

I'm not really convinced yet -- comments? - chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  mobile +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/


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



More information about the Stackless mailing list