lua-users home
lua-l archive

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


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