mirror of
https://github.com/lua/lua.git
synced 2025-01-28 06:03:00 +08:00
GC step does not unblock collector (when it is blocked by "stop")
This commit is contained in:
parent
4db2cddeee
commit
e23da9edee
5
lapi.c
5
lapi.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lapi.c,v 2.66 2008/02/19 18:55:09 roberto Exp roberto $
|
||||
** $Id: lapi.c,v 2.67 2008/07/04 18:27:11 roberto Exp roberto $
|
||||
** Lua API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -906,6 +906,7 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
|
||||
break;
|
||||
}
|
||||
case LUA_GCSTEP: {
|
||||
lu_mem oldts = g->GCthreshold;
|
||||
lu_mem a = (cast(lu_mem, data) << 10);
|
||||
g->GCthreshold = (a <= g->totalbytes) ? g->totalbytes - a : 0;
|
||||
while (g->GCthreshold <= g->totalbytes) {
|
||||
@ -915,6 +916,8 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (oldts == MAX_LUMEM) /* collector was stopped? */
|
||||
g->GCthreshold = oldts; /* keep it that way */
|
||||
break;
|
||||
}
|
||||
case LUA_GCSETPAUSE: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user