[Stackless] can i use tasklet in c in this way?

zouguangxian zouguangxian at hotmail.com
Tue Oct 5 16:08:33 CEST 2004


hi all,
   can i use tasklet in c in this way?

PyObject* module,process;
std::string filename;
Py_Initialize(); 
while (1) {
   //Load a script file ,how to do that ?
    func = PyObject_GetAttrString(script, "init");
    process = PyTasklet_New(NULL, func); 
   if ( PyTasklet_Run(process) ==-1) {
       printf("[%s:]", "tasklet run failed.");
   }
  ...
}
when i use this way in dice1.c ,i got some fatal error. do i need to use PyRun_SimpleString for each script file ? and i must use PyStackless_Call_Main and PyStackless_Schedule ?  

I understand tasklet in this way: tasklet is created using PyTasklet_New,but at this time,it is not put into runnable list. so i have to use PyTasklet_Insert to scheduled it or PyTasklet_Run to run it immediatly. but i don't know why it will cause error without PyRun_SimpleString / PyStackless_Call_Main . can you give me some help ?

thanks

-weck
-------------- next part --------------
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless


More information about the Stackless mailing list