diff -durN a/lua-5.1.4/src/lapi.c b/lua-5.1.4/src/lapi.c --- a/lua-5.1.4/src/lapi.c Fri Jul 4 20:41:18 2008 +++ b/lua-5.1.4/src/lapi.c Thu Aug 6 16:08:57 2009 @@ -94,7 +94,7 @@ LUA_API int lua_checkstack (lua_State *L, int size) { int res = 1; - lua_lock(L); + luai_lock(L); if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK) res = 0; /* stack overflow */ else if (size > 0) { @@ -102,7 +102,7 @@ if (L->ci->top < L->top + size) L->ci->top = L->top + size; } - lua_unlock(L); + luai_unlock(L); return res; } @@ -110,7 +110,7 @@ LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { int i; if (from == to) return; - lua_lock(to); + luai_lock(to); api_checknelems(from, n); api_check(from, G(from) == G(to)); api_check(from, to->ci->top - to->top >= n); @@ -118,7 +118,7 @@ for (i = 0; i < n; i++) { setobj2s(to, to->top++, from->top + i); } - lua_unlock(to); + luai_unlock(to); } @@ -129,22 +129,22 @@ LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { lua_CFunction old; - lua_lock(L); + luai_lock(L); old = G(L)->panic; G(L)->panic = panicf; - lua_unlock(L); + luai_unlock(L); return old; } LUA_API lua_State *lua_newthread (lua_State *L) { lua_State *L1; - lua_lock(L); + luai_lock(L); luaC_checkGC(L); L1 = luaE_newthread(L); setthvalue(L, L->top, L1); api_incr_top(L); - lua_unlock(L); + luai_unlock(L); luai_userstatethread(L, L1); return L1; } @@ -162,7 +162,7 @@ LUA_API void lua_settop (lua_State *L, int idx) { - lua_lock(L); + luai_lock(L); if (idx >= 0) { api_check(L, idx <= L->stack_last - L->base); while (L->top < L->base + idx) @@ -173,36 +173,36 @@ api_check(L, -(idx+1) <= (L->top - L->base)); L->top += idx+1; /* `subtract' index (index is negative) */ } - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_remove (lua_State *L, int idx) { StkId p; - lua_lock(L); + luai_lock(L); p = index2adr(L, idx); api_checkvalidindex(L, p); while (++p < L->top) setobjs2s(L, p-1, p); L->top--; - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_insert (lua_State *L, int idx) { StkId p; StkId q; - lua_lock(L); + luai_lock(L); p = index2adr(L, idx); api_checkvalidindex(L, p); for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); setobjs2s(L, p, L->top); - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_replace (lua_State *L, int idx) { StkId o; - lua_lock(L); + luai_lock(L); /* explicit test for incompatible code */ if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci) luaG_runerror(L, "no calling environment"); @@ -221,15 +221,15 @@ luaC_barrier(L, curr_func(L), L->top - 1); } L->top--; - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_pushvalue (lua_State *L, int idx) { - lua_lock(L); + luai_lock(L); setobj2s(L, L->top, index2adr(L, idx)); api_incr_top(L); - lua_unlock(L); + luai_unlock(L); } @@ -287,11 +287,11 @@ LUA_API int lua_equal (lua_State *L, int index1, int index2) { StkId o1, o2; int i; - lua_lock(L); /* may call tag method */ + luai_lock(L); /* may call tag method */ o1 = index2adr(L, index1); o2 = index2adr(L, index2); i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 : equalobj(L, o1, o2); - lua_unlock(L); + luai_unlock(L); return i; } @@ -299,12 +299,12 @@ LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { StkId o1, o2; int i; - lua_lock(L); /* may call tag method */ + luai_lock(L); /* may call tag method */ o1 = index2adr(L, index1); o2 = index2adr(L, index2); i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 : luaV_lessthan(L, o1, o2); - lua_unlock(L); + luai_unlock(L); return i; } @@ -343,15 +343,15 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { StkId o = index2adr(L, idx); if (!ttisstring(o)) { - lua_lock(L); /* `luaV_tostring' may create a new string */ + luai_lock(L); /* `luaV_tostring' may create a new string */ if (!luaV_tostring(L, o)) { /* conversion failed? */ if (len != NULL) *len = 0; - lua_unlock(L); + luai_unlock(L); return NULL; } luaC_checkGC(L); o = index2adr(L, idx); /* previous call may reallocate the stack */ - lua_unlock(L); + luai_unlock(L); } if (len != NULL) *len = tsvalue(o)->len; return svalue(o); @@ -366,9 +366,9 @@ case LUA_TTABLE: return luaH_getn(hvalue(o)); case LUA_TNUMBER: { size_t l; - lua_lock(L); /* `luaV_tostring' may create a new string */ + luai_lock(L); /* `luaV_tostring' may create a new string */ l = (luaV_tostring(L, o) ? tsvalue(o)->len : 0); - lua_unlock(L); + luai_unlock(L); return l; } default: return 0; @@ -419,35 +419,35 @@ LUA_API void lua_pushnil (lua_State *L) { - lua_lock(L); + luai_lock(L); setnilvalue(L->top); api_incr_top(L); - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { - lua_lock(L); + luai_lock(L); setnvalue(L->top, n); api_incr_top(L); - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { - lua_lock(L); + luai_lock(L); setnvalue(L->top, cast_num(n)); api_incr_top(L); - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { - lua_lock(L); + luai_lock(L); luaC_checkGC(L); setsvalue2s(L, L->top, luaS_newlstr(L, s, len)); api_incr_top(L); - lua_unlock(L); + luai_unlock(L); } @@ -462,10 +462,10 @@ LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, va_list argp) { const char *ret; - lua_lock(L); + luai_lock(L); luaC_checkGC(L); ret = luaO_pushvfstring(L, fmt, argp); - lua_unlock(L); + luai_unlock(L); return ret; } @@ -473,19 +473,19 @@ LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { const char *ret; va_list argp; - lua_lock(L); + luai_lock(L); luaC_checkGC(L); va_start(argp, fmt); ret = luaO_pushvfstring(L, fmt, argp); va_end(argp); - lua_unlock(L); + luai_unlock(L); return ret; } LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { Closure *cl; - lua_lock(L); + luai_lock(L); luaC_checkGC(L); api_checknelems(L, n); cl = luaF_newCclosure(L, n, getcurrenv(L)); @@ -496,31 +496,31 @@ setclvalue(L, L->top, cl); lua_assert(iswhite(obj2gco(cl))); api_incr_top(L); - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_pushboolean (lua_State *L, int b) { - lua_lock(L); + luai_lock(L); setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ api_incr_top(L); - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { - lua_lock(L); + luai_lock(L); setpvalue(L->top, p); api_incr_top(L); - lua_unlock(L); + luai_unlock(L); } LUA_API int lua_pushthread (lua_State *L) { - lua_lock(L); + luai_lock(L); setthvalue(L, L->top, L); api_incr_top(L); - lua_unlock(L); + luai_unlock(L); return (G(L)->mainthread == L); } @@ -533,54 +533,54 @@ LUA_API void lua_gettable (lua_State *L, int idx) { StkId t; - lua_lock(L); + luai_lock(L); t = index2adr(L, idx); api_checkvalidindex(L, t); luaV_gettable(L, t, L->top - 1, L->top - 1); - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { StkId t; TValue key; - lua_lock(L); + luai_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); + luai_unlock(L); } LUA_API void lua_rawget (lua_State *L, int idx) { StkId t; - lua_lock(L); + luai_lock(L); t = index2adr(L, idx); api_check(L, ttistable(t)); setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { StkId o; - lua_lock(L); + luai_lock(L); o = index2adr(L, idx); api_check(L, ttistable(o)); setobj2s(L, L->top, luaH_getnum(hvalue(o), n)); api_incr_top(L); - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { - lua_lock(L); + luai_lock(L); luaC_checkGC(L); sethvalue(L, L->top, luaH_new(L, narray, nrec)); api_incr_top(L); - lua_unlock(L); + luai_unlock(L); } @@ -588,7 +588,7 @@ const TValue *obj; Table *mt = NULL; int res; - lua_lock(L); + luai_lock(L); obj = index2adr(L, objindex); switch (ttype(obj)) { case LUA_TTABLE: @@ -608,14 +608,14 @@ api_incr_top(L); res = 1; } - lua_unlock(L); + luai_unlock(L); return res; } LUA_API void lua_getfenv (lua_State *L, int idx) { StkId o; - lua_lock(L); + luai_lock(L); o = index2adr(L, idx); api_checkvalidindex(L, o); switch (ttype(o)) { @@ -633,7 +633,7 @@ break; } api_incr_top(L); - lua_unlock(L); + luai_unlock(L); } @@ -644,60 +644,60 @@ LUA_API void lua_settable (lua_State *L, int idx) { StkId t; - lua_lock(L); + luai_lock(L); api_checknelems(L, 2); t = index2adr(L, idx); api_checkvalidindex(L, t); luaV_settable(L, t, L->top - 2, L->top - 1); L->top -= 2; /* pop index and value */ - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { StkId t; TValue key; - lua_lock(L); + luai_lock(L); api_checknelems(L, 1); t = index2adr(L, idx); api_checkvalidindex(L, t); setsvalue(L, &key, luaS_new(L, k)); luaV_settable(L, t, &key, L->top - 1); L->top--; /* pop value */ - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_rawset (lua_State *L, int idx) { StkId t; - lua_lock(L); + luai_lock(L); api_checknelems(L, 2); t = index2adr(L, idx); api_check(L, ttistable(t)); setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); luaC_barriert(L, hvalue(t), L->top-1); L->top -= 2; - lua_unlock(L); + luai_unlock(L); } LUA_API void lua_rawseti (lua_State *L, int idx, int n) { StkId o; - lua_lock(L); + luai_lock(L); api_checknelems(L, 1); o = index2adr(L, idx); api_check(L, ttistable(o)); setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1); luaC_barriert(L, hvalue(o), L->top-1); L->top--; - lua_unlock(L); + luai_unlock(L); } LUA_API int lua_setmetatable (lua_State *L, int objindex) { TValue *obj; Table *mt; - lua_lock(L); + luai_lock(L); api_checknelems(L, 1); obj = index2adr(L, objindex); api_checkvalidindex(L, obj); @@ -726,7 +726,7 @@ } } L->top--; - lua_unlock(L); + luai_unlock(L); return 1; } @@ -734,7 +734,7 @@ LUA_API int lua_setfenv (lua_State *L, int idx) { StkId o; int res = 1; - lua_lock(L); + luai_lock(L); api_checknelems(L, 1); o = index2adr(L, idx); api_checkvalidindex(L, o); @@ -755,7 +755,7 @@ } if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); L->top--; - lua_unlock(L); + luai_unlock(L); return res; } @@ -775,13 +775,13 @@ LUA_API void lua_call (lua_State *L, int nargs, int nresults) { StkId func; - lua_lock(L); + luai_lock(L); api_checknelems(L, nargs+1); checkresults(L, nargs, nresults); func = L->top - (nargs+1); luaD_call(L, func, nresults); adjustresults(L, nresults); - lua_unlock(L); + luai_unlock(L); } @@ -806,7 +806,7 @@ struct CallS c; int status; ptrdiff_t func; - lua_lock(L); + luai_lock(L); api_checknelems(L, nargs+1); checkresults(L, nargs, nresults); if (errfunc == 0) @@ -820,7 +820,7 @@ c.nresults = nresults; status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); adjustresults(L, nresults); - lua_unlock(L); + luai_unlock(L); return status; } @@ -850,11 +850,11 @@ LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { struct CCallS c; int status; - lua_lock(L); + luai_lock(L); c.func = func; c.ud = ud; status = luaD_pcall(L, f_Ccall, &c, savestack(L, L->top), 0); - lua_unlock(L); + luai_unlock(L); return status; } @@ -863,11 +863,11 @@ const char *chunkname) { ZIO z; int status; - lua_lock(L); + luai_lock(L); if (!chunkname) chunkname = "?"; luaZ_init(L, &z, reader, data); status = luaD_protectedparser(L, &z, chunkname); - lua_unlock(L); + luai_unlock(L); return status; } @@ -875,14 +875,14 @@ LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) { int status; TValue *o; - lua_lock(L); + luai_lock(L); api_checknelems(L, 1); o = L->top - 1; if (isLfunction(o)) status = luaU_dump(L, clvalue(o)->l.p, writer, data, 0); else status = 1; - lua_unlock(L); + luai_unlock(L); return status; } @@ -899,7 +899,7 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { int res = 0; global_State *g; - lua_lock(L); + luai_lock(L); g = G(L); switch (what) { case LUA_GCSTOP: { @@ -950,7 +950,7 @@ } default: res = -1; /* invalid option */ } - lua_unlock(L); + luai_unlock(L); return res; } @@ -962,10 +962,10 @@ LUA_API int lua_error (lua_State *L) { - lua_lock(L); + luai_lock(L); api_checknelems(L, 1); luaG_errormsg(L); - lua_unlock(L); + luai_unlock(L); return 0; /* to avoid warnings */ } @@ -973,7 +973,7 @@ LUA_API int lua_next (lua_State *L, int idx) { StkId t; int more; - lua_lock(L); + luai_lock(L); t = index2adr(L, idx); api_check(L, ttistable(t)); more = luaH_next(L, hvalue(t), L->top - 1); @@ -982,13 +982,13 @@ } else /* no more elements */ L->top -= 1; /* remove key */ - lua_unlock(L); + luai_unlock(L); return more; } LUA_API void lua_concat (lua_State *L, int n) { - lua_lock(L); + luai_lock(L); api_checknelems(L, n); if (n >= 2) { luaC_checkGC(L); @@ -1000,36 +1000,36 @@ api_incr_top(L); } /* else n == 1; nothing to do */ - lua_unlock(L); + luai_unlock(L); } LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { lua_Alloc f; - lua_lock(L); + luai_lock(L); if (ud) *ud = G(L)->ud; f = G(L)->frealloc; - lua_unlock(L); + luai_unlock(L); return f; } LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { - lua_lock(L); + luai_lock(L); G(L)->ud = ud; G(L)->frealloc = f; - lua_unlock(L); + luai_unlock(L); } LUA_API void *lua_newuserdata (lua_State *L, size_t size) { Udata *u; - lua_lock(L); + luai_lock(L); luaC_checkGC(L); u = luaS_newudata(L, size, getcurrenv(L)); setuvalue(L, L->top, u); api_incr_top(L); - lua_unlock(L); + luai_unlock(L); return u + 1; } @@ -1057,13 +1057,13 @@ LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { const char *name; TValue *val; - lua_lock(L); + luai_lock(L); name = aux_upvalue(index2adr(L, funcindex), n, &val); if (name) { setobj2s(L, L->top, val); api_incr_top(L); } - lua_unlock(L); + luai_unlock(L); return name; } @@ -1072,7 +1072,7 @@ const char *name; TValue *val; StkId fi; - lua_lock(L); + luai_lock(L); fi = index2adr(L, funcindex); api_checknelems(L, 1); name = aux_upvalue(fi, n, &val); @@ -1081,7 +1081,7 @@ setobj(L, val, L->top); luaC_barrier(L, clvalue(fi), L->top); } - lua_unlock(L); + luai_unlock(L); return name; } diff -durN a/lua-5.1.4/src/ldebug.c b/lua-5.1.4/src/ldebug.c --- a/lua-5.1.4/src/ldebug.c Thu May 8 18:56:26 2008 +++ b/lua-5.1.4/src/ldebug.c Thu Aug 6 16:08:57 2009 @@ -84,7 +84,7 @@ LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { int status; CallInfo *ci; - lua_lock(L); + luai_lock(L); for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) { level--; if (f_isLua(ci)) /* Lua function? */ @@ -99,7 +99,7 @@ ar->i_ci = 0; } else status = 0; /* no such level */ - lua_unlock(L); + luai_unlock(L); return status; } @@ -127,10 +127,10 @@ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { CallInfo *ci = L->base_ci + ar->i_ci; const char *name = findlocal(L, ci, n); - lua_lock(L); + luai_lock(L); if (name) luaA_pushobject(L, ci->base + (n - 1)); - lua_unlock(L); + luai_unlock(L); return name; } @@ -138,11 +138,11 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { CallInfo *ci = L->base_ci + ar->i_ci; const char *name = findlocal(L, ci, n); - lua_lock(L); + luai_lock(L); if (name) setobjs2s(L, ci->base + (n - 1), L->top - 1); L->top--; /* pop value */ - lua_unlock(L); + luai_unlock(L); return name; } @@ -233,7 +233,7 @@ int status; Closure *f = NULL; CallInfo *ci = NULL; - lua_lock(L); + luai_lock(L); if (*what == '>') { StkId func = L->top - 1; luai_apicheck(L, ttisfunction(func)); @@ -254,7 +254,7 @@ } if (strchr(what, 'L')) collectvalidlines(L, f); - lua_unlock(L); + luai_unlock(L); return status; } diff -durN a/lua-5.1.4/src/ldo.c b/lua-5.1.4/src/ldo.c --- a/lua-5.1.4/src/ldo.c Fri Jan 18 23:31:22 2008 +++ b/lua-5.1.4/src/ldo.c Thu Aug 6 16:08:57 2009 @@ -100,7 +100,7 @@ L->status = cast_byte(errcode); if (G(L)->panic) { resetstack(L, errcode); - lua_unlock(L); + luai_unlock(L); G(L)->panic(L); } exit(EXIT_FAILURE); @@ -194,9 +194,9 @@ L->ci->top = L->top + LUA_MINSTACK; lua_assert(L->ci->top <= L->stack_last); L->allowhook = 0; /* cannot call hooks inside a hook */ - lua_unlock(L); + luai_unlock(L); (*hook)(L, &ar); - lua_lock(L); + luai_lock(L); lua_assert(!L->allowhook); L->allowhook = 1; L->ci->top = restorestack(L, ci_top); @@ -315,9 +315,9 @@ ci->nresults = nresults; if (L->hookmask & LUA_MASKCALL) luaD_callhook(L, LUA_HOOKCALL, -1); - lua_unlock(L); + luai_unlock(L); n = (*curr_func(L)->c.f)(L); /* do the actual call */ - lua_lock(L); + luai_lock(L); if (n < 0) /* yielding? */ return PCRYIELD; else { @@ -409,14 +409,14 @@ L->top = L->ci->base; setsvalue2s(L, L->top, luaS_new(L, msg)); incr_top(L); - lua_unlock(L); + luai_unlock(L); return LUA_ERRRUN; } LUA_API int lua_resume (lua_State *L, int nargs) { int status; - lua_lock(L); + luai_lock(L); if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci)) return resume_error(L, "cannot resume non-suspended coroutine"); if (L->nCcalls >= LUAI_MAXCCALLS) @@ -435,19 +435,19 @@ status = L->status; } --L->nCcalls; - lua_unlock(L); + luai_unlock(L); return status; } LUA_API int lua_yield (lua_State *L, int nresults) { luai_userstateyield(L, nresults); - lua_lock(L); + luai_lock(L); if (L->nCcalls > L->baseCcalls) luaG_runerror(L, "attempt to yield across metamethod/C-call boundary"); L->base = L->top - nresults; /* protect stack slots below */ L->status = LUA_YIELD; - lua_unlock(L); + luai_unlock(L); return -1; } diff -durN a/lua-5.1.4/src/ldump.c b/lua-5.1.4/src/ldump.c --- a/lua-5.1.4/src/ldump.c Thu Dec 27 14:02:25 2007 +++ b/lua-5.1.4/src/ldump.c Thu Aug 6 16:08:57 2009 @@ -30,9 +30,9 @@ { if (D->status==0) { - lua_unlock(D->L); + luai_unlock(D->L); D->status=(*D->writer)(D->L,b,size,D->data); - lua_lock(D->L); + luai_lock(D->L); } } diff -durN a/lua-5.1.4/src/llimits.h b/lua-5.1.4/src/llimits.h --- a/lua-5.1.4/src/llimits.h Thu Dec 27 14:02:25 2007 +++ b/lua-5.1.4/src/llimits.h Thu Aug 6 16:08:57 2009 @@ -106,13 +106,13 @@ #endif -#ifndef lua_lock -#define lua_lock(L) ((void) 0) -#define lua_unlock(L) ((void) 0) +#ifndef luai_lock +#define luai_lock(L) ((void) 0) +#define luai_unlock(L) ((void) 0) #endif #ifndef luai_threadyield -#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} +#define luai_threadyield(L) {luai_unlock(L); luai_lock(L);} #endif diff -durN a/lua-5.1.4/src/lstate.c b/lua-5.1.4/src/lstate.c --- a/lua-5.1.4/src/lstate.c Thu Jan 3 16:20:39 2008 +++ b/lua-5.1.4/src/lstate.c Thu Aug 6 16:08:57 2009 @@ -198,7 +198,7 @@ LUA_API void lua_close (lua_State *L) { L = G(L)->mainthread; /* only the main thread can be closed */ - lua_lock(L); + luai_lock(L); luaF_close(L, L->stack); /* close all upvalues for this thread */ luaC_separateudata(L, 1); /* separate udata that have GC metamethods */ L->errfunc = 0; /* no error function during GC metamethods */ @@ -210,5 +210,13 @@ lua_assert(G(L)->tmudata == NULL); luai_userstateclose(L); close_state(L); +} + +LUA_API void lua_lock (lua_State *L) { + luai_lock(L); +} + +LUA_API void lua_unlock (lua_State *L) { + luai_unlock(L); } diff -durN a/lua-5.1.4/src/lua.h b/lua-5.1.4/src/lua.h --- a/lua-5.1.4/src/lua.h Wed Aug 6 15:30:12 2008 +++ b/lua-5.1.4/src/lua.h Thu Aug 6 16:08:57 2009 @@ -298,6 +298,9 @@ LUA_API void lua_setlevel (lua_State *from, lua_State *to); +LUA_API void lua_lock (lua_State *L); +LUA_API void lua_unlock (lua_State *L); + /* ** {====================================================================== ** Debug API diff -durN a/lua-5.1.4/src/luac.c b/lua-5.1.4/src/luac.c --- a/lua-5.1.4/src/luac.c Fri Jun 2 19:37:11 2006 +++ b/lua-5.1.4/src/luac.c Thu Aug 6 16:08:57 2009 @@ -174,9 +174,9 @@ { FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); if (D==NULL) cannot("open"); - lua_lock(L); + luai_lock(L); luaU_dump(L,f,writer,D,stripping); - lua_unlock(L); + luai_unlock(L); if (ferror(D)) cannot("write"); if (fclose(D)) cannot("close"); } diff -durN a/lua-5.1.4/src/lzio.c b/lua-5.1.4/src/lzio.c --- a/lua-5.1.4/src/lzio.c Thu Dec 27 14:02:25 2007 +++ b/lua-5.1.4/src/lzio.c Thu Aug 6 16:08:57 2009 @@ -22,9 +22,9 @@ size_t size; lua_State *L = z->L; const char *buff; - lua_unlock(L); + luai_unlock(L); buff = z->reader(L, z->data, &size); - lua_lock(L); + luai_lock(L); if (buff == NULL || size == 0) return EOZ; z->n = size - 1; z->p = buff;