[Stackless] unexpected tasklet & channel behaviour

Richard Tew richard.m.tew at gmail.com
Wed Nov 1 10:37:29 CET 2006


On 11/1/06, Christian Tismer <tismer at stackless.com> wrote:
> tasklet.run just re-inserts a tasklet and makes it the
> next tasklet to be run.
> I think you are referring to stackless.run, which in fact
> does nothing than scheduling until all tasklets are exhausted.

I thought I was repeating a description you posted of how
tasklet.run works :-)  But this is what I mean by it, which
seems to meet the description:

>>> def f(n):
...     while True:
...             print n
...             stackless.schedule()
...
>>> t1 = stackless.tasklet(f)(1)
>>> t2 = stackless.tasklet(f)(2)
>>> t3 = stackless.tasklet(f)(3)
>>>
>>> t1.run()
1
2
3
>>> t1.run()
1
2
3
>>>

I have wanted the ability to just run one tasklet in the past, but
could not see how to do it cleanly.  So what I would do, and this
was in fix to the tasklet killing on interpreter exit, was to place
the tasklet I wanted to run before the current one, then to run
the one I wanted to be run.. and it did the job to fix the bug
that was present there.

Anyway, I think most people expect tasklet.run to just run one
tasklet and I think it would be a worthwhile change to make.

Richard.

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list