[Stackless] Figuring out stackless for use in Twisted
Christian Tismer
tismer at tismer.com
Wed Jul 30 06:48:06 CEST 2003
Christopher Armstrong wrote:
...
> Hrm... Does that mean that I might get context switches in arbitrary
> points in my code, or only when "blocking" on a channel.send() or
> channel.receive()? If the latter, I would call that "implicit
> cooperative scheduling", not really pre-emptive. :-) I hope it's the
> latter!
Please refer to the docstrings of channel methods.
(Hoping the info is in fact there :)
If a tasklet is blocked in a channel, it is blocked.
Scheduling, whether explicitly done (stackless.schedule())
or implicitly, pre-emmptive (by a still-to-be implemented
option to stackless.run(), for instance), will never
happen for anything but the list of runnable tasklets.
The tasklets in the chain of a channel are really, really
blocked
...
>>def callUserFunction(self, f, *args, **kwargs):
>> t = stackless.tasklet(f)
>> c = stackless.channel()
>> t(c, *args, **kwargs)
>> t.run()
>
>
>
> I really needed this example! Thanks. Hmm, __call__ needs a docstring
> :)
If it hasn't, then it is so because I didn't understand where to
put it.
Shorter:
c = stackless.channel()
stackless.tasklet(f)(c, *args, **kwargs).run()
ciao - chris
--
Christian Tismer :^) <mailto:tismer at tismer.com>
Mission Impossible 5oftware : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34 home +49 30 802 86 56 pager +49 173 24 18 776
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
_______________________________________________
Stackless mailing list
Stackless at www.tismer.com
http://www.tismer.com/mailman/listinfo/stackless
More information about the Stackless
mailing list