commit 7a8eb83b4a4e49a1f76ddce254fce72b71149e74
parent ab5fa213b3912d25e340bf22bb65a825be500aac
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Fri, 8 Nov 2013 16:16:08 -0200
bug: attempting to resume the running coroutine makes it unyieldable
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ldo.c b/ldo.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldo.c,v 2.110 2013/08/27 18:53:35 roberto Exp roberto $
+** $Id: ldo.c,v 2.111 2013/09/17 15:40:06 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@@ -538,6 +538,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;
@@ -559,7 +560,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);