aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-03-30 15:39:20 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2009-03-30 15:39:20 -0300
commit4e43741943780b6fc21d2e93d1e99812778cad24 (patch)
treed3b6f1e9b81e02ad9a42d1e45758469d8ed5b1fb /lapi.c
parenta274596ecc6edc4a8f2377943ee86fac6ff80acc (diff)
downloadlua-4e43741943780b6fc21d2e93d1e99812778cad24.tar.gz
lua-4e43741943780b6fc21d2e93d1e99812778cad24.tar.bz2
lua-4e43741943780b6fc21d2e93d1e99812778cad24.zip
in 'lua_call', avoid preparing a continuation when thread cannot yield.
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lapi.c b/lapi.c
index eb4fe4f3..9b1f2462 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.71 2009/03/10 17:14:37 roberto Exp roberto $ 2** $Id: lapi.c,v 2.72 2009/03/23 14:26:12 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -779,14 +779,14 @@ LUA_API void lua_callk (lua_State *L, int nargs, int nresults, int ctx,
779 api_checknelems(L, nargs+1); 779 api_checknelems(L, nargs+1);
780 checkresults(L, nargs, nresults); 780 checkresults(L, nargs, nresults);
781 func = L->top - (nargs+1); 781 func = L->top - (nargs+1);
782 if (k != NULL) { 782 if (k != NULL && L->nny == 0) { /* need to prepare continuation? */
783 L->ci->u.c.k = k; 783 L->ci->u.c.k = k; /* save continuation */
784 L->ci->u.c.ctx = ctx; 784 L->ci->u.c.ctx = ctx; /* save context */
785 L->ci->callstatus |= CIST_CTX; 785 L->ci->callstatus |= CIST_CTX; /* mark that call has context */
786 luaD_call(L, func, nresults, 1); 786 luaD_call(L, func, nresults, 1); /* do the call */
787 } 787 }
788 else 788 else /* no continuation or no yieldable */
789 luaD_call(L, func, nresults, 0); 789 luaD_call(L, func, nresults, 0); /* just do the call */
790 adjustresults(L, nresults); 790 adjustresults(L, nresults);
791 lua_unlock(L); 791 lua_unlock(L);
792} 792}