mirror of
https://github.com/lua/lua.git
synced 2025-02-04 06:13:04 +08:00
in 'lua_call', avoid preparing a continuation when thread cannot yield.
This commit is contained in:
parent
a274596ecc
commit
4e43741943
16
lapi.c
16
lapi.c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lapi.c,v 2.71 2009/03/10 17:14:37 roberto Exp roberto $
|
** $Id: lapi.c,v 2.72 2009/03/23 14:26:12 roberto Exp roberto $
|
||||||
** Lua API
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -779,14 +779,14 @@ LUA_API void lua_callk (lua_State *L, int nargs, int nresults, int ctx,
|
|||||||
api_checknelems(L, nargs+1);
|
api_checknelems(L, nargs+1);
|
||||||
checkresults(L, nargs, nresults);
|
checkresults(L, nargs, nresults);
|
||||||
func = L->top - (nargs+1);
|
func = L->top - (nargs+1);
|
||||||
if (k != NULL) {
|
if (k != NULL && L->nny == 0) { /* need to prepare continuation? */
|
||||||
L->ci->u.c.k = k;
|
L->ci->u.c.k = k; /* save continuation */
|
||||||
L->ci->u.c.ctx = ctx;
|
L->ci->u.c.ctx = ctx; /* save context */
|
||||||
L->ci->callstatus |= CIST_CTX;
|
L->ci->callstatus |= CIST_CTX; /* mark that call has context */
|
||||||
luaD_call(L, func, nresults, 1);
|
luaD_call(L, func, nresults, 1); /* do the call */
|
||||||
}
|
}
|
||||||
else
|
else /* no continuation or no yieldable */
|
||||||
luaD_call(L, func, nresults, 0);
|
luaD_call(L, func, nresults, 0); /* just do the call */
|
||||||
adjustresults(L, nresults);
|
adjustresults(L, nresults);
|
||||||
lua_unlock(L);
|
lua_unlock(L);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user