[Stackless] You cannot __reduce__ the tasklet ...
Arman Bostani
arman at twinsun.com
Wed Jun 2 22:42:56 CEST 2004
Christian Tismer wrote:
> Arman Bostani wrote:
>
>> Another dumb question: why do you want to forbid execution of pickled
>> "current" tasklets? What's special about them?
>
>
> It is that I cannot capture the current frame in a consistent
> way, since it is in a call to the tasklet's __reduce__ which
> is not stackless. So the current tasklet would always show
> up as one that raises an exception when run.
> But maybe this would be ok.
> This is where I wasn't sure about, but I agree that forbidding
> it is a half-assed solution. The idea of tasklet pickling
> is to pickle everything, even if it cannot be revived, just
> to have some state to inspect or partially execute.
>
> I will change this when i get an idea what to do.
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?
-arman
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list