[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Q: Lua 5.2 thread environments...
- From: Anthony Howe <achowe+lua@...>
- Date: Wed, 30 Mar 2011 20:11:26 +0200
>From the 5.2 alpha documentation, section 8.1 – Changes in the Language:
"Threads do not have individual environments. All threads share a single fixed environment.
This doesn't sound good.
In my current network application I am developing, I rely on the ability for threads to have separate "environments" (contexts) in
order to ensure that data placed into the thread's global space does NOT appear in another thread's global space or the master state
from which the thread was originally created.
It is important when you load and define a master state from which you can "clone" / share an initial state (thus avoid creating a
new state and reloading all the time), since there is no lua_forkstate or lua_clonestate functions.
How will a thread ensure that data defined within it remains confined to that thread? Currently I rely on changing the thread's
LUA_GLOBALSINDEX to a metatable assigned to the thread that confines data.
--
Anthony C Howe Skype: SirWumpus SnertSoft
Twitter: SirWumpus BarricadeMX & Milters
http://snert.com/ http://nanozen.info/ http://snertsoft.com/