[Stackless] tasklets on threads

Kristján Valur Jónsson kristjan at ccpgames.com
Thu Sep 8 00:19:29 CEST 2011


I just realized that there are various interesting ways to crash stackless with threads.
This one is simple
Import treading, stackless
Def foo():
  Global task
  Task = stackless.getcurrent()
Threading.Thread(target=foo).start()
...
Task.thread_id

This will crash because the other thread's task->cstate is NULL.

This is fixable.  But what about other cases?  Tasklets that are blocked (or removed) when their thread exits?
Their task->cstate->tstate will be invalid.  And so, there are a number of things that can be done to crash them, like task.insert(), I imagine.
Should we worry about this?  Or should we simply require of the programmer that for safe operation, a thread should exist at least as long as all tasklets created on it, and leave it to the programmer to ensure?

K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20110907/646ca830/attachment.html>


More information about the Stackless mailing list