lua-users home
lua-l archive

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


Triggering the garbage collection in the LUA code itself is not an
option, it has to be done in the C code as the collection itself
should be as transparent as possible for the user.

Perhaps I wasn't clear enough in what I attempted to state. The
threads won't get garbage collected after ended execution because
there is still a reference to them in the global state stack. I need
to remove it, hopefully based on the information I can find in
lua_State itself.

The sleep function that yields a thread inserts the lua_State and the
desired execution time in a std::map<float, lua_State *>, which the
other part of the application then accesses and executes a lua_resume
on when it finds an entry the time has expired for.

- Petter Rønningen

On 7/16/05, Ben Sunshine-Hill <sneftel@gmail.com> wrote:
> On 7/15/05, Petter Rønningen <tankefugl@gmail.com> wrote:
> > If it yields, another part of the
> > application will resume the lua_State at the appropriate time.
> >
> > This leaves me with a problem regarding the garbage collection, since
> > the thread is on the global state's stack when created. I cannot pop
> > it after creating it because it will ruin for the lua_resume on the
> > thread after a potential yield.
> 
> Well, you need to put it somewhere.... and in the Lua world, not the C
> world. This "another part" that resumes it later.... how does it know
> where the thread is?
>