mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Limit number of userdata __gc separations at state close.
This commit is contained in:
parent
e14b6346b4
commit
44876ec99f
@ -234,6 +234,7 @@ static TValue *cpfinalize(lua_State *L, lua_CFunction dummy, void *ud)
|
||||
LUA_API void lua_close(lua_State *L)
|
||||
{
|
||||
global_State *g = G(L);
|
||||
int i;
|
||||
L = mainthread(g); /* Only the main thread can be closed. */
|
||||
lj_func_closeuv(L, tvref(L->stack));
|
||||
lj_gc_separateudata(g, 1); /* Separate udata which have GC metamethods. */
|
||||
@ -242,7 +243,7 @@ LUA_API void lua_close(lua_State *L)
|
||||
G2J(g)->state = LJ_TRACE_IDLE;
|
||||
lj_dispatch_update(g);
|
||||
#endif
|
||||
for (;;) {
|
||||
for (i = 0; i < 10; ) {
|
||||
hook_enter(g);
|
||||
L->status = 0;
|
||||
L->cframe = NULL;
|
||||
@ -251,6 +252,7 @@ LUA_API void lua_close(lua_State *L)
|
||||
lj_gc_separateudata(g, 1); /* Separate udata again. */
|
||||
if (gcref(g->gc.mmudata) == NULL) /* Until nothing is left to do. */
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
close_state(L);
|
||||
|
Loading…
Reference in New Issue
Block a user