lua-users home
lua-l archive

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


* Sam Roberts (vieuxtech@gmail.com) wrote:

> 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.

Since I'm new to lua, perhaps you'll forgive me a basic question: where
will references to a thread stored in this case: 

lua_State* lua = lua_open();
lua_State* thread = lua_newthread(lua);
lua_getglobal(thread, "somefunc");
lua_resume(thread, 0);

and how do I remove them?

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru