diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-03-30 15:39:20 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-03-30 15:39:20 -0300 |
| commit | 4e43741943780b6fc21d2e93d1e99812778cad24 (patch) | |
| tree | d3b6f1e9b81e02ad9a42d1e45758469d8ed5b1fb | |
| parent | a274596ecc6edc4a8f2377943ee86fac6ff80acc (diff) | |
| download | lua-4e43741943780b6fc21d2e93d1e99812778cad24.tar.gz lua-4e43741943780b6fc21d2e93d1e99812778cad24.tar.bz2 lua-4e43741943780b6fc21d2e93d1e99812778cad24.zip | |
in 'lua_call', avoid preparing a continuation when thread cannot yield.
| -rw-r--r-- | lapi.c | 16 |
1 files changed, 8 insertions, 8 deletions
| @@ -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 | } |
