Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Tracks the canon cLuaState instances for each lua_State pointer. More...
Static Public Member Functions | |
static void | Add (cLuaState &a_LuaState) |
Adds a new canon cLuaState instance to the map. More... | |
static cLuaState * | GetCanonState (lua_State *a_LuaState) |
Returns the canon Lua state for the specified lua_State pointer. More... | |
static void | Remove (cLuaState &a_LuaState) |
Removes the bindings between the specified canon state and its lua_State pointer. More... | |
Static Protected Member Functions | |
static cCanonLuaStates & | GetInstance (void) |
Returns the singleton instance of this class. More... | |
Protected Attributes | |
std::map< lua_State *, cLuaState * > | m_CanonStates |
Map of lua_State pointers to their canon cLuaState instances. More... | |
cCriticalSection | m_CS |
The mutex protecting m_CanonStates against multithreaded access. More... | |
Tracks the canon cLuaState instances for each lua_State pointer.
Used for tracked refs - the ref needs to be tracked by a single cLuaState (the canon state), despite being created from a different (attached) cLuaState. The canon state must be available without accessing the Lua state itself (so it cannot be stored within Lua).
Definition at line 63 of file LuaState.cpp.
|
inlinestatic |
Adds a new canon cLuaState instance to the map.
Used when a new Lua state is created, this informs the map that a new canon Lua state should be tracked.
Definition at line 81 of file LuaState.cpp.
|
inlinestatic |
Returns the canon Lua state for the specified lua_State pointer.
Definition at line 67 of file LuaState.cpp.
|
inlinestaticprotected |
Returns the singleton instance of this class.
Definition at line 109 of file LuaState.cpp.
|
inlinestatic |
Removes the bindings between the specified canon state and its lua_State pointer.
Used when a Lua state is being closed.
Definition at line 91 of file LuaState.cpp.
|
protected |
Map of lua_State pointers to their canon cLuaState instances.
Definition at line 105 of file LuaState.cpp.
|
protected |
The mutex protecting m_CanonStates against multithreaded access.
Definition at line 102 of file LuaState.cpp.