Re: lua_State and garbage collection
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: lua_State and garbage collection
- From: Petter Rønningen <tankefugl@...>
- Date: 2005年7月16日 05:02:38 +0200
Awesome, that sounds perfect. Thanks a lot.
- Petter Rønningen
On 7/16/05, Ben Sunshine-Hill <sneftel@gmail.com> wrote:
> You're just keeping all the threads around in the C stack of the main
> thread? That'll work, I suppose, but is not the best way to keep a
> reference around. Use luaL_ref to get an integer reference to the
> thread, and pop it off the stack. Store the references in your
> std::map<float, int>, and access the threads using luaL_getref. When
> you're ready to forget about a thread, just use luaL_unref; since it's
> the only remaining reference to the thread, the GC will handle the
> rest.
>
> Ben
>