lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I have noticed a problem when I create a large amount of co-routines from C code.
 
it seems that when i call:  cr=lua_newthread(state);
 
it is pushed onto the stack of 'state' per the documentation.
 
however after I have loaded code and run the co-routine using lua_resume, it's status is still '0', and the thread never gets garbage collected, eventually resulting in a stack overflow.
 
it seems that by manually popping the thread off of the 'state' stack stops this problem, but I was under the impression that after running the co-routine it should be 'dead' and thus garbage collected.
 
do I /really/ need to go back and pop these threads off of the stack after they are done?
 
and if the status always returns 0 how can I know when they are done?
 
Thank you for your time,
 
Raymond Jacobs
Ethereal Darkness Interactive