lua-users home
lua-l archive

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


On Jan 6, 2010, at 12:03 PM, Roberto Ierusalimschy wrote:

> In C, it is not difficult to use the thread itself as a key to store
> per-thread data in the registry, if necessary.

Also, see Lua Gems chapter 1 on per-thread local storage using the function environment LUA_ENVIRONINDEX. A unique function environment is shared among all C functions in a library, and per-thread storage is placed there in a table weak-keyed by thread. This saves a trip to the registry, and keeps the data private to the library.

e