lua-users home
lua-l archive

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


On Tuesday 17, kathrin_69@gmx.de wrote:
> So given the code above: Is there any difference between calling
> lua_close() on pChild or on pParent?
> I know that I've not to call lua_close(pChild); to cleanup anything,
> because coroutines are subject to GC. I'm just asking to get better
> understanding of inner mechanics.

No, calling lua_close() on either the child or the parent thread will free the 
mainthread and all child threads.

First line from lua_close():
L = G(L)->mainthread;  /* only the main thread can be closed */

So it always switches to the mainthread.

-- 
Robert G. Jakabosky