[Stackless] How to "transfer" a tasklet to the current thread

Kristján Valur Jónsson kristjan at ccpgames.com
Tue Nov 12 13:04:30 CET 2013

I'm working on this stuff, but I noticed another thread bug:

> -----Original Message-----
> From: stackless-bounces at stackless.com [mailto:stackless-
> bounces at stackless.com] On Behalf Of Anselm Kruis
> Sent: 11. nóvember 2013 19:23
> To: stackless at stackless.com
> Subject: Re: [Stackless] How to "transfer" a tasklet to the current thread
>      def testForeignThread_scheduled(self):
>          theThread = threading.Thread(target=self.create_tasklet,
> args=(self.tasklet_action,))
>          theThread.start()
>          theThread.join()
>          t = self.tasklet
>          self.assertEqual(t.thread_id, theThread.ident)
>          self.assertTrue(t.alive)
>          self.assertFalse(t.paused)

Your code illustrates an unrelated problem.  the foreign thread is dead, yet the tasklet is still bound to it.
The freshly created tasklet is not killed properly when the thread goes away, leaving its cstate->tstate invalid.

Not so good.


More information about the Stackless mailing list