[Stackless] tasklets on threads

Richard Tew richard.m.tew at gmail.com
Thu Sep 8 16:00:58 CEST 2011


2011/9/8 Kristján Valur Jónsson <kristjan at ccpgames.com>:
> Well, we don't keep track of tasklets anywhere.

No?  What goes on at interpreter shut down?  Don't we go through the
list of tasklets in some function there killing them?  I seem to
recall fixing a crash bug there at some stage in the past.

If a thread exits and there are tasklets that have hard switched, I
think that there is no other choice but to explicitly kill them.
Letting those that don't rely on thread stack space continue to exist,
is no problem.

> Even without extra threads, python can exit when there is a tasklet is detached.  It may get killed when its final reference goes away, but it has nothing to do with the main thread exiting.
> I don't think we ought to have some catalog of tasklets to clean up when a thread goes away.  It is always possible for other threads to have access to those tasklets anyway and keep them alive.  The only thing that could be done were to have the cstate->tstate somehow magically cleared....
> That ought to be possible, with special logic.  Keep a list of cstates in the tstate to clear when the tstate dies....

What are the repercussions of keeping a tasklet alive, but killing the
cstate from underneath it?  It sounds a bit.. sloppy, or maybe I am
missing something?

Cheers,
Richard.



More information about the Stackless mailing list