lua-users home
lua-l archive

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


>In my application, threads are handled entirely through C code, not 
>Lua. I use the C functions, lua_newthread() and lua_resume(), to 
>create and resume threads, rather than the Lua methods, 
>coroutine.create and coroutine.resume. Assuming that threads are 
>never referenced explicitly in my Lua code, what do I need to do on 
>the C side of things to ensure that all references to a thread are 
>gone?

The same thing you would do to make sure all references to a table are gone,
that is, the thread (which is now a Lua value, remember!) must not be on
the stack, must not be the value of a global variable, nor a value or key
in a table or the registry, not an upvalue in any function, and so on.
--lhf