Purpose of lua_lock and lua_unlock?
Posted
by anon
on Stack Overflow
See other posts from Stack Overflow
or by anon
Published on 2010-06-10T00:49:17Z
Indexed on
2010/06/10
0:52 UTC
Read the original article
Hit count: 432
lua
What is the point of lua_lock and lua_unlock?
The following implies it's important:
LUA_API void lua_gettable (lua_State *L, int idx) {
StkId t;
lua_lock(L);
t = index2adr(L, idx);
api_checkvalidindex(L, t);
luaV_gettable(L, t, L->top - 1, L->top - 1);
lua_unlock(L);
}
LUA_API void lua_getfield (lua_State *L, int idx, const char *k) {
StkId t;
TValue key;
lua_lock(L);
t = index2adr(L, idx);
api_checkvalidindex(L, t);
setsvalue(L, &key, luaS_new(L, k));
luaV_gettable(L, t, &key, L->top);
api_incr_top(L);
lua_unlock(L);
}
The following implies it does nothing:
#define lua_lock(L) ((void) 0)
#define lua_unlock(L) ((void) 0)
Please enlighten.
© Stack Overflow or respective owner