[Stackless] Returning a Value with a Tasklet

A.M. aelorean at yahoo.com
Mon Jun 8 22:02:08 CEST 2009


Ok -- I've been trying to wrap my brain around stackless and the use of tasklets over the past few days, so please excuse me if this is a stupid question.   Basically, I now understand how to create a start a tasklet using the C API based upon what I saw in the examples here on your site (dice1.cpp):
 
----
/* start the python function as a tasklet */
func = PyObject_GetAttrString(main, "everySecond");
process = PyTasklet_New(NULL, func);
Py_DECREF(func);
/* initialize the tasklet args */
args = PyTuple_New(0);
PyTasklet_Setup(process, args, NULL);
Py_DECREF(args);
----
 
This I understand, and it seems to work well:  the tasklet is created, it's added to the queue, and it's executed when its turn comes.
 
However, my question was whether or not you can have a tasklet actually return a value, and how you would go about doing that with the C API?   In other words, imagine that the func above returns a PyObject* value ...how would I retrieve that?
 
Again, I'm sorry if this is a stupid question and/or inappropriate; however, I've searched all over the internet for examples of just about every function in the stackless C API file ...and, just about the only things available are what is here in your 'examples'.  
 
 
Also -- if anyone knows of a good, simple example of a C Application that utilizes stackless (similar to dice1.cpp) ...but, involves a main tasklet loop AND creates additional tasklets with channels and so forth...that would be great.  I really would like to understand all of this in C (simply) before using a crutch (ie, boost libs.)
 
Thanks!


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20090608/16d5264b/attachment.htm>


More information about the Stackless mailing list