aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2016-10-19 10:31:42 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2016-10-19 10:31:42 -0200
commit138d00176ca3330b0ad18eb4006605746b68df94 (patch)
tree2a25fcaa3e658550b4d040d1db61ba2a8670f042 /lgc.c
parent8edbf57fb8e3c20aac9560b7e4cce7583d14ebf6 (diff)
downloadlua-138d00176ca3330b0ad18eb4006605746b68df94.tar.gz
lua-138d00176ca3330b0ad18eb4006605746b68df94.tar.bz2
lua-138d00176ca3330b0ad18eb4006605746b68df94.zip
new flag in 'CallInfo.callstatus' to tell whether function is running
as a finalizer
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lgc.c b/lgc.c
index 5eae15d7..7da00442 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.211 2015/12/10 18:12:30 roberto Exp roberto $ 2** $Id: lgc.c,v 2.212 2016/03/31 19:02:03 roberto Exp roberto $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -818,7 +818,9 @@ static void GCTM (lua_State *L, int propagateerrors) {
818 setobj2s(L, L->top, tm); /* push finalizer... */ 818 setobj2s(L, L->top, tm); /* push finalizer... */
819 setobj2s(L, L->top + 1, &v); /* ... and its argument */ 819 setobj2s(L, L->top + 1, &v); /* ... and its argument */
820 L->top += 2; /* and (next line) call the finalizer */ 820 L->top += 2; /* and (next line) call the finalizer */
821 L->ci->callstatus |= CIST_FIN; /* will run a finalizer */
821 status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0); 822 status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0);
823 L->ci->callstatus &= ~CIST_FIN; /* not running a finalizer anymore */
822 L->allowhook = oldah; /* restore hooks */ 824 L->allowhook = oldah; /* restore hooks */
823 g->gcrunning = running; /* restore state */ 825 g->gcrunning = running; /* restore state */
824 if (status != LUA_OK && propagateerrors) { /* error while running __gc? */ 826 if (status != LUA_OK && propagateerrors) { /* error while running __gc? */