mirror of
https://github.com/lua/lua
synced 2024-11-28 15:43:08 +03:00
"Emergency" new version 5.4.6
'lua_resetthread' is back to its original signature, to avoid incompatibilities in the ABI between releases of the same version. New function 'lua_closethread' added with the "correct" signature.
This commit is contained in:
parent
e15f1f2bb7
commit
6443185167
@ -76,7 +76,7 @@ static int luaB_auxwrap (lua_State *L) {
|
||||
if (l_unlikely(r < 0)) { /* error? */
|
||||
int stat = lua_status(co);
|
||||
if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */
|
||||
stat = lua_resetthread(co, L); /* close its tbc variables */
|
||||
stat = lua_closethread(co, L); /* close its tbc variables */
|
||||
lua_assert(stat != LUA_OK);
|
||||
lua_xmove(co, L, 1); /* move error message to the caller */
|
||||
}
|
||||
@ -172,7 +172,7 @@ static int luaB_close (lua_State *L) {
|
||||
int status = auxstatus(L, co);
|
||||
switch (status) {
|
||||
case COS_DEAD: case COS_YIELD: {
|
||||
status = lua_resetthread(co, L);
|
||||
status = lua_closethread(co, L);
|
||||
if (status == LUA_OK) {
|
||||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
|
10
lstate.c
10
lstate.c
@ -339,7 +339,7 @@ int luaE_resetthread (lua_State *L, int status) {
|
||||
}
|
||||
|
||||
|
||||
LUA_API int lua_resetthread (lua_State *L, lua_State *from) {
|
||||
LUA_API int lua_closethread (lua_State *L, lua_State *from) {
|
||||
int status;
|
||||
lua_lock(L);
|
||||
L->nCcalls = (from) ? getCcalls(from) : 0;
|
||||
@ -349,6 +349,14 @@ LUA_API int lua_resetthread (lua_State *L, lua_State *from) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Deprecated! Use 'lua_closethread' instead.
|
||||
*/
|
||||
LUA_API int lua_resetthread (lua_State *L) {
|
||||
return lua_closethread(L, NULL);
|
||||
}
|
||||
|
||||
|
||||
LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
|
||||
int i;
|
||||
lua_State *L;
|
||||
|
2
ltests.c
2
ltests.c
@ -1533,7 +1533,7 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) {
|
||||
lua_newthread(L1);
|
||||
}
|
||||
else if EQ("resetthread") {
|
||||
lua_pushinteger(L1, lua_resetthread(L1, L));
|
||||
lua_pushinteger(L1, lua_resetthread(L1)); /* deprecated */
|
||||
}
|
||||
else if EQ("newuserdata") {
|
||||
lua_newuserdata(L1, getnum);
|
||||
|
7
lua.h
7
lua.h
@ -18,10 +18,10 @@
|
||||
|
||||
#define LUA_VERSION_MAJOR "5"
|
||||
#define LUA_VERSION_MINOR "4"
|
||||
#define LUA_VERSION_RELEASE "5"
|
||||
#define LUA_VERSION_RELEASE "6"
|
||||
|
||||
#define LUA_VERSION_NUM 504
|
||||
#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 5)
|
||||
#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 6)
|
||||
|
||||
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
|
||||
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
|
||||
@ -163,7 +163,8 @@ extern const char lua_ident[];
|
||||
LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
|
||||
LUA_API void (lua_close) (lua_State *L);
|
||||
LUA_API lua_State *(lua_newthread) (lua_State *L);
|
||||
LUA_API int (lua_resetthread) (lua_State *L, lua_State *from);
|
||||
LUA_API int (lua_closethread) (lua_State *L, lua_State *from);
|
||||
LUA_API int (lua_resetthread) (lua_State *L); /* Deprecated! */
|
||||
|
||||
LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
|
||||
|
||||
|
@ -3167,6 +3167,27 @@ when called through this function.
|
||||
|
||||
}
|
||||
|
||||
@APIEntry{int lua_closethread (lua_State *L, lua_State *from);|
|
||||
@apii{0,?,-}
|
||||
|
||||
Resets a thread, cleaning its call stack and closing all pending
|
||||
to-be-closed variables.
|
||||
Returns a status code:
|
||||
@Lid{LUA_OK} for no errors in the thread
|
||||
(either the original error that stopped the thread or
|
||||
errors in closing methods),
|
||||
or an error status otherwise.
|
||||
In case of error,
|
||||
leaves the error object on the top of the stack.
|
||||
|
||||
The parameter @id{from} represents the coroutine that is resetting @id{L}.
|
||||
If there is no such coroutine,
|
||||
this parameter can be @id{NULL}.
|
||||
|
||||
(This function was introduced in @N{release 5.4.6}.)
|
||||
|
||||
}
|
||||
|
||||
@APIEntry{int lua_compare (lua_State *L, int index1, int index2, int op);|
|
||||
@apii{0,0,e}
|
||||
|
||||
@ -4160,23 +4181,12 @@ and then pops the top element.
|
||||
|
||||
}
|
||||
|
||||
@APIEntry{int lua_resetthread (lua_State *L, lua_State *from);|
|
||||
@APIEntry{int lua_resetthread (lua_State *L);|
|
||||
@apii{0,?,-}
|
||||
|
||||
Resets a thread, cleaning its call stack and closing all pending
|
||||
to-be-closed variables.
|
||||
Returns a status code:
|
||||
@Lid{LUA_OK} for no errors in the thread
|
||||
(either the original error that stopped the thread or
|
||||
errors in closing methods),
|
||||
or an error status otherwise.
|
||||
In case of error,
|
||||
leaves the error object on the top of the stack.
|
||||
|
||||
The parameter @id{from} represents the coroutine that is resetting @id{L}.
|
||||
If there is no such coroutine,
|
||||
this parameter can be @id{NULL}.
|
||||
(This parameter was introduced in @N{release 5.4.5}.)
|
||||
This function is deprecated;
|
||||
it is equivalent to @Lid{lua_closethread} with
|
||||
@id{from} being @id{NULL}.
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user