lua-users home
lua-l archive

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


On Thu, Apr 05, 2007 at 02:27:50PM -0700, Erik Cassel wrote:
> Is there a way with the API to find out how many uncollected threads there
> are in a lua_State?

I've never seen one, but perhaps somebody else can comment.

I wonder if you couldn't track this yourself, including the
hierarchy, with a weak-keyed table, where the key was a thread,
and the value was a table. That value should be weak-keyed, too.
Then you could build insert threads into the hierarchy, lua would remove
them as they are garbage collected, and at any time you could print
the thread hierarchy.

You'd have to hook any places creating threads/coroutines to insert them
in the thread tree tables.

Sam