diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-11-08 16:16:33 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-11-08 16:16:33 -0200 |
commit | 7a8eb83b4a4e49a1f76ddce254fce72b71149e74 (patch) | |
tree | 00d5e6b2c99afee581ecb58a66094993d4f8a6e6 | |
parent | ab5fa213b3912d25e340bf22bb65a825be500aac (diff) | |
download | lua-7a8eb83b4a4e49a1f76ddce254fce72b71149e74.tar.gz lua-7a8eb83b4a4e49a1f76ddce254fce72b71149e74.tar.bz2 lua-7a8eb83b4a4e49a1f76ddce254fce72b71149e74.zip |
bug: attempting to resume the running coroutine makes it unyieldable
-rw-r--r-- | ldo.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.110 2013/08/27 18:53:35 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.111 2013/09/17 15:40:06 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -538,6 +538,7 @@ static void resume (lua_State *L, void *ud) { | |||
538 | 538 | ||
539 | LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) { | 539 | LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) { |
540 | int status; | 540 | int status; |
541 | int oldnny = L->nny; /* save 'nny' */ | ||
541 | lua_lock(L); | 542 | lua_lock(L); |
542 | luai_userstateresume(L, nargs); | 543 | luai_userstateresume(L, nargs); |
543 | L->nCcalls = (from) ? from->nCcalls + 1 : 1; | 544 | L->nCcalls = (from) ? from->nCcalls + 1 : 1; |
@@ -559,7 +560,7 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) { | |||
559 | } | 560 | } |
560 | lua_assert(status == L->status); | 561 | lua_assert(status == L->status); |
561 | } | 562 | } |
562 | L->nny = 1; /* do not allow yields */ | 563 | L->nny = oldnny; /* restore 'nny' */ |
563 | L->nCcalls--; | 564 | L->nCcalls--; |
564 | lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0)); | 565 | lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0)); |
565 | lua_unlock(L); | 566 | lua_unlock(L); |