lua-users home
lua-l archive

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


Greetings,

Having created a thread using lua_newthread(), is there a way to determine the status of the thread from C? That is, whether it's waiting to be initialized (resumed for the first time), waiting to be resumed as a result of yielding, or dead (finished executing)?

My main motivation here is wanting to check the status of the thread after each resume so that I can release any associated C resources if the thread is dead. I realize I could have the thread make a C call prior to returning, but it seems like this would be a nice to have feature for thread management.

Also, when exactly is a thread garbage collected? Hopefully only if it's dead, but I'd like to confirm that.

-Brian