diff options
Diffstat (limited to '')
| -rw-r--r-- | src/3rdParty/lua/lapi.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/3rdParty/lua/lapi.c b/src/3rdParty/lua/lapi.c index 071a06f..5ee6579 100644 --- a/src/3rdParty/lua/lapi.c +++ b/src/3rdParty/lua/lapi.c | |||
| @@ -1136,18 +1136,19 @@ LUA_API int lua_status (lua_State *L) { | |||
| 1136 | LUA_API int lua_gc (lua_State *L, int what, ...) { | 1136 | LUA_API int lua_gc (lua_State *L, int what, ...) { |
| 1137 | va_list argp; | 1137 | va_list argp; |
| 1138 | int res = 0; | 1138 | int res = 0; |
| 1139 | global_State *g; | 1139 | global_State *g = G(L); |
| 1140 | if (g->gcstp & GCSTPGC) /* internal stop? */ | ||
| 1141 | return -1; /* all options are invalid when stopped */ | ||
| 1140 | lua_lock(L); | 1142 | lua_lock(L); |
| 1141 | g = G(L); | ||
| 1142 | va_start(argp, what); | 1143 | va_start(argp, what); |
| 1143 | switch (what) { | 1144 | switch (what) { |
| 1144 | case LUA_GCSTOP: { | 1145 | case LUA_GCSTOP: { |
| 1145 | g->gcrunning = 0; | 1146 | g->gcstp = GCSTPUSR; /* stopped by the user */ |
| 1146 | break; | 1147 | break; |
| 1147 | } | 1148 | } |
| 1148 | case LUA_GCRESTART: { | 1149 | case LUA_GCRESTART: { |
| 1149 | luaE_setdebt(g, 0); | 1150 | luaE_setdebt(g, 0); |
| 1150 | g->gcrunning = 1; | 1151 | g->gcstp = 0; /* (GCSTPGC must be already zero here) */ |
| 1151 | break; | 1152 | break; |
| 1152 | } | 1153 | } |
| 1153 | case LUA_GCCOLLECT: { | 1154 | case LUA_GCCOLLECT: { |
| @@ -1166,8 +1167,8 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
| 1166 | case LUA_GCSTEP: { | 1167 | case LUA_GCSTEP: { |
| 1167 | int data = va_arg(argp, int); | 1168 | int data = va_arg(argp, int); |
| 1168 | l_mem debt = 1; /* =1 to signal that it did an actual step */ | 1169 | l_mem debt = 1; /* =1 to signal that it did an actual step */ |
| 1169 | lu_byte oldrunning = g->gcrunning; | 1170 | lu_byte oldstp = g->gcstp; |
| 1170 | g->gcrunning = 1; /* allow GC to run */ | 1171 | g->gcstp = 0; /* allow GC to run (GCSTPGC must be zero here) */ |
| 1171 | if (data == 0) { | 1172 | if (data == 0) { |
| 1172 | luaE_setdebt(g, 0); /* do a basic step */ | 1173 | luaE_setdebt(g, 0); /* do a basic step */ |
| 1173 | luaC_step(L); | 1174 | luaC_step(L); |
| @@ -1177,7 +1178,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
| 1177 | luaE_setdebt(g, debt); | 1178 | luaE_setdebt(g, debt); |
| 1178 | luaC_checkGC(L); | 1179 | luaC_checkGC(L); |
| 1179 | } | 1180 | } |
| 1180 | g->gcrunning = oldrunning; /* restore previous state */ | 1181 | g->gcstp = oldstp; /* restore previous state */ |
| 1181 | if (debt > 0 && g->gcstate == GCSpause) /* end of cycle? */ | 1182 | if (debt > 0 && g->gcstate == GCSpause) /* end of cycle? */ |
| 1182 | res = 1; /* signal it */ | 1183 | res = 1; /* signal it */ |
| 1183 | break; | 1184 | break; |
| @@ -1195,7 +1196,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
| 1195 | break; | 1196 | break; |
| 1196 | } | 1197 | } |
| 1197 | case LUA_GCISRUNNING: { | 1198 | case LUA_GCISRUNNING: { |
| 1198 | res = g->gcrunning; | 1199 | res = gcrunning(g); |
| 1199 | break; | 1200 | break; |
| 1200 | } | 1201 | } |
| 1201 | case LUA_GCGEN: { | 1202 | case LUA_GCGEN: { |
