** call a few (up to 'g->gcfinnum') finalizers */
| 842 | ** call a few (up to 'g->gcfinnum') finalizers |
| 843 | */ |
| 844 | static int runafewfinalizers (lua_State *L) { |
| 845 | global_State *g = G(L); |
| 846 | unsigned int i; |
| 847 | lua_assert(!g->tobefnz || g->gcfinnum > 0); |
| 848 | for (i = 0; g->tobefnz && i < g->gcfinnum; i++) |
| 849 | GCTM(L, 1); /* call one finalizer */ |
| 850 | g->gcfinnum = (!g->tobefnz) ? 0 /* nothing more to finalize? */ |
| 851 | : g->gcfinnum * 2; /* else call a few more next time */ |
| 852 | return i; |
| 853 | } |
| 854 | |
| 855 | |
| 856 | /* |
no test coverage detected