lua-users home
lua-l archive

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


> >> I think it is not necessary to close thread by any function. 
> >> Threads is stored in the lua state and garbage-collected
> >> like tables or functions.
> 
> NT> I believe this is correct, but a little confusing, because the handle
> NT> you have for your thread/coroutine is a lua_State*.
> 
> IMHO, this is like userdata. They stored in lua state and the same
> time have "real world" (outside of lua state) pointers.

Next code incorrect?
--------
lua_State *thr = lua_newthread (L);
lua_pop (L, 1);
lua_pushnil (thr);
--------
Ie in lua tables not exist reference to thread and it collected?

IMO, userdata stored in table. Is it correct store pointer to userdata outside lua tables? GC may change it's location?