mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Add collectgarbage("isrunning").
This commit is contained in:
parent
0b09c971c9
commit
86c21bd245
@ -435,13 +435,13 @@ LJLIB_CF(gcinfo)
|
||||
LJLIB_CF(collectgarbage)
|
||||
{
|
||||
int opt = lj_lib_checkopt(L, 1, LUA_GCCOLLECT, /* ORDER LUA_GC* */
|
||||
"\4stop\7restart\7collect\5count\1\377\4step\10setpause\12setstepmul");
|
||||
"\4stop\7restart\7collect\5count\1\377\4step\10setpause\12setstepmul\1\377\11isrunning");
|
||||
int32_t data = lj_lib_optint(L, 2, 0);
|
||||
if (opt == LUA_GCCOUNT) {
|
||||
setnumV(L->top, (lua_Number)G(L)->gc.total/1024.0);
|
||||
} else {
|
||||
int res = lua_gc(L, opt, data);
|
||||
if (opt == LUA_GCSTEP)
|
||||
if (opt == LUA_GCSTEP || opt == LUA_GCISRUNNING)
|
||||
setboolV(L->top, res);
|
||||
else
|
||||
setintV(L->top, res);
|
||||
|
@ -1188,6 +1188,9 @@ LUA_API int lua_gc(lua_State *L, int what, int data)
|
||||
res = (int)(g->gc.stepmul);
|
||||
g->gc.stepmul = (MSize)data;
|
||||
break;
|
||||
case LUA_GCISRUNNING:
|
||||
res = (g->gc.threshold != LJ_MAX_MEM);
|
||||
break;
|
||||
default:
|
||||
res = -1; /* Invalid option. */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user