lua-users home
lua-l archive

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


On Thu, Feb 2, 2012 at 9:33 AM, Dmitry Marakasov <amdmi3@amdmi3.ru> wrote:
> However, out of curiocity: should/may lua_State got from lua_newthread
> be disposed in any way (lua_close) after it finishes? Yields? Gets an
> error?

The thread will garbage collected if you don't keep a reference to it.

You shouldn't close it, but when you don't want it anymore, you should
remove references to it so that it can be garbage collected.

http://www.lua.org/manual/5.1/manual.html#lua_newthread: There is no
explicit function to close or to destroy a thread. Threads are subject
to garbage collection, like any Lua object.

Cheers,
Sam