[Stackless] Killing a tasklet waiting on PyChannel_Receive in C module fails

Christian Tismer tismer at stackless.com
Wed Feb 25 23:11:40 CET 2009


On 2/23/09 10:53 PM, Chris Jacobson wrote:

> That does bring me to a question that came up as I looked through it:
> when are the appropriate situations for using the _nr functions?

The _nr versions of functions are most efficient, but also
most difficult to support.
Every code that tries to run a _nr (non-recursive) function
must be aware of the ternary return-logic:

Normal PyObject         - as usual
NULL plus exception set - as usual
Py_UnwindToken          - very special.

In case of a Py_UnwindToken as the return value, you *have to*
finish your function right now and to return the Py_UnwindToken,
yourself.

This implements the collaborative context switching without C stack
mangling and is the fastest known way. It is also mandatory
if you want to support pickling: Your function must leave the C stack.

These things have never been used for anything else than building
the internal framework of tasklets and channels, and there is no
support or documentation planned for it.
Writing code like this is what Stackless wants to take away from
you, instead of supporting it in an API.

If you want to play, look into the source how unwinding is handled.
But you can't expect support on this from the list or myself.

cheers - chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     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 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
       whom do you want to sponsor today?   http://www.stackless.com/




More information about the Stackless mailing list