[Stackless] why the TaskletExit?

Richard Tew richard.m.tew at gmail.com
Wed Jan 24 22:17:04 CET 2007

On 1/24/07, Andrew Dalke <dalke at dalkescientific.com> wrote:
> That still doesn't describe the behavior I see, which is that
> a receive raises a TaskExit exception.
> Hmm, perhaps it's part of the garbage collection?  Yeah,
> that's it.

Right.  Keep in mind that the tasklet for 'main' will have a reference
to 'chan' and 'chan' will have a reference to tasklets blocking on
it which just happens to be the same one which holds a referene
to it.  So there is no way where the tasklet for 'main' can get
garbage collected until the interpreter exits, where you see the
channel get garbage collected and this results in the tasklet
blocking on it being killed.  Except when you hold the extra
reference to it in the globals.

It appears if you have references to things in the globals,
then they will not get cleared before the garbage
collection.  So while the channel may get freed your local
reference to the tasklet prevents it from being garbage
collected at that stage and therefore being cleanly killed with
a TaskletExit.  This is not something I have looked into
unlike the channel/tasklet garbage collection thing which
was responsible for a crasher in the past.


Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list