[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua registry, environment, and threads.
- From: Mark Hamburg <mark@...>
- Date: Wed, 6 Jan 2010 22:51:29 -0800
On Jan 6, 2010, at 9:03 AM, Roberto Ierusalimschy wrote:
>> Does that mean in 5.2, I can't have any per-thread data? It has to
>> be global to a Lua state or private to a function?
>
> Note that in 5.1 the built-in per-thread data is not very useful, as you
> cannot access it from Lua. (That is the main reason why we are removing
> it).
>
> In C, it is not difficult to use the thread itself as a key to store
> per-thread data in the registry, if necessary.
I could see an argument for still supporting C access to an environment table attached to a thread. As with the environment table attached to userdata, it wouldn't be particularly "environmental" but it eliminates one case where I would assume one would otherwise need a semi-weak table. I know 5.2 has the new marking logic for semi-weak tables, but I also know that logic is potentially expensive depending on the actual graph structure so it seems like a good idea to provide alternatives where feasible.
Mark
- References:
- Lua registry, environment, and threads., Christian Tellefsen
- Re: Lua registry, environment, and threads., Patrick Donnelly
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy
- Re: Lua registry, environment, and threads., Christian Tellefsen
- Re: Lua registry, environment, and threads., Roberto Ierusalimschy