[Stackless] Calling a tasklet with a return value with the C API

A M aelorean at gmail.com
Tue Dec 29 10:09:14 CET 2009


After a few years of scouring the Internet for example code and viewing the
very sparse documentation on the subject, I have been able to successfully
utilize almost all aspects of the C API with regard to stackless python.  I
feel pretty comfortable with most all functions declared in stackless_api.h.

However, there is one thing I cannot figure out and cannot find an example
for anywhere:  running a tasklet with the C API that returns a value.  Take,
for example, this python code from one of the stackless python examples
online (
http://stacklessexamples.googlecode.com/svn/trunk/examples/producerConsumerTextmode.py
):

-----------
def launch_p (ind,sleeptime):         # Launches and initializes the
producers lists
    producers.append(int(ind))
    p_counter.append(0)
    producers[int(ind)] = stackless.tasklet(producer)(ind,sleeptime)
------------

The last line is the one that I have no idea how to recreate.  Certainly,
creating a tasklet, setting it up, and running it is trivial; however, I
cannot for the life of me figure out how you would get a return value
with the C API.   My initial thought was perhaps the results are sent back
on a 'channel'; however, I do not see any documentation that supports that,
nor can I find any examples of it.

Anyway, can anyone help me out with this?  It's keeping me awake at night!
If not, can someone give me a contact address for one of the developers of
stackless that wrote the C API for it?

Thanks
Andy

ps.  By the way, does anyone know why this link indicates that it's the
C/C++ API for stackless 2.6.4 but has none of the stackless functions within
it?  ->
http://www.disinterest.org/resource/stackless/2.6.4-docs-html/c-api/index.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20091229/20437361/attachment.htm>


More information about the Stackless mailing list