[Stackless] tasklets on threads

Richard Tew richard.m.tew at gmail.com
Fri Sep 9 03:23:36 CEST 2011


2011/9/8 Kristján Valur Jónsson <kristjan at ccpgames.com>:
> On Behalf Of Richard Tew:
>> 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.
> tasklets are killed if their reference goes to zero and they are still alive.  I think we rely on reference counting to do their job.

I dashed off the last email just before I hit the sack, and didn't
have the time to search.  But this is what I meant:

pystate.c:268

  void
  PyThreadState_Clear(PyThreadState *tstate)
  {
  #ifdef STACKLESS
      STACKLESS_PYSTATE_CLEAR;
  #endif

stackless_tstate.h:102

  #define STACKLESS_PYSTATE_CLEAR \
      __STACKLESS_PYSTATE_CLEAR \
      Py_CLEAR(tstate->st.thread.block_lock); \
      tstate->st.thread.is_blocked = 0;

stackless_tstate.h:90

  #define __STACKLESS_PYSTATE_CLEAR \
      slp_kill_tasks_with_stacks(tstate); \
      Py_CLEAR(tstate->st.initial_stub);

stacklesseval.c:131

  void slp_kill_tasks_with_stacks(PyThreadState *ts)
  {

Am I missing something, or is this not doing exactly what we are
discussing already?

That leaves tasklets without cstates, which should.. be handled nicely.

Cheers,
Richard.



More information about the Stackless mailing list