diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-11-08 16:22:50 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-11-08 16:22:50 -0200 |
commit | 686705554686358b75a5247643007bca6f5a880c (patch) | |
tree | a320145d5c27a337df85590f84e3e7270449ae6c | |
parent | 2fb7d94bd606715d0163cab7b4546f8a4d1f3426 (diff) | |
download | lua-github-686705554686358b75a5247643007bca6f5a880c.tar.gz |
bug: Resuming the running coroutine makes it unyieldable
-rw-r--r-- | ldo.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 2.108.1.1 2013/04/12 18:48:47 roberto Exp roberto $ +** $Id: ldo.c,v 2.108.1.2 2013/04/19 21:03:23 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -534,6 +534,7 @@ static void resume (lua_State *L, void *ud) { LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) { int status; + int oldnny = L->nny; /* save 'nny' */ lua_lock(L); luai_userstateresume(L, nargs); L->nCcalls = (from) ? from->nCcalls + 1 : 1; @@ -555,7 +556,7 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) { } lua_assert(status == L->status); } - L->nny = 1; /* do not allow yields */ + L->nny = oldnny; /* restore 'nny' */ L->nCcalls--; lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0)); lua_unlock(L); |